[Devel] [PATCH RHEL7 COMMIT] ms/nfsd: fix jiffies/time_t mixup in LRU list
Vasily Averin
vvs at virtuozzo.com
Wed Nov 24 14:49:59 MSK 2021
The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.4
------>
commit 0f59eeb6878eba2ccda78d8e98261aa4b7213e76
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Wed Nov 24 14:49:57 2021 +0300
ms/nfsd: fix jiffies/time_t mixup in LRU list
The nfsd4_blocked_lock->nbl_time timestamp is recorded in jiffies,
but then compared to a CLOCK_REALTIME timestamp later on, which makes
no sense.
For consistency with the other timestamps, change this to use a time_t.
This is a change in behavior, which may cause regressions, but the
current code is not sensible. On a system with CONFIG_HZ=1000,
the 'time_after((unsigned long)nbl->nbl_time, (unsigned long)cutoff))'
check is false for roughly the first 18 days of uptime and then true
for the next 49 days.
Fixes: 7919d0a27f1e ("nfsd: add a LRU list for blocked locks")
Signed-off-by: Arnd Bergmann <arnd at arndb.de>
Signed-off-by: J. Bruce Fields <bfields at redhat.com>
(cherry picked from commit 9594497f2c78993cb66b696122f7c65528ace985)
https://jira.sw.ru/browse/PSBM-102407
https://jira.sw.ru/browse/PSBM-121875
https://jira.sw.ru/browse/PSBM-121984
https://jira.sw.ru/browse/PSBM-129208
https://jira.sw.ru/browse/PSBM-129647
https://jira.sw.ru/browse/PSBM-133020
https://jira.sw.ru/browse/PSBM-133265
https://jira.sw.ru/browse/PSBM-133274
https://jira.sw.ru/browse/PSBM-134762
https://jira.sw.ru/browse/PSBM-134877
https://jira.sw.ru/browse/PSBM-134905
https://jira.sw.ru/browse/PSBM-135845
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
fs/nfsd/nfs4state.c | 2 +-
fs/nfsd/state.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 07e9681..4a57b40 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5991,7 +5991,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
}
if (fl_flags & FL_SLEEP) {
- nbl->nbl_time = jiffies;
+ nbl->nbl_time = get_seconds();
spin_lock(&nn->blocked_locks_lock);
list_add_tail(&nbl->nbl_list, &lock_sop->lo_blocked);
list_add_tail(&nbl->nbl_lru, &nn->blocked_locks_lru);
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 770b1c6..f53db66 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -583,7 +583,7 @@ enum nfsd4_cb_op {
struct nfsd4_blocked_lock {
struct list_head nbl_list;
struct list_head nbl_lru;
- unsigned long nbl_time;
+ time_t nbl_time;
struct file_lock nbl_lock;
struct knfsd_fh nbl_fh;
struct nfsd4_callback nbl_cb;
More information about the Devel
mailing list