Skip to content

Commit 669210a

Browse files
arndbgregkh
authored andcommitted
nfsd: fix jiffies/time_t mixup in LRU list
commit 9594497 upstream. 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: 7919d0a ("nfsd: add a LRU list for blocked locks") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1df92bf commit 669210a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/nfsd/nfs4state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6034,7 +6034,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
60346034
}
60356035

60366036
if (fl_flags & FL_SLEEP) {
6037-
nbl->nbl_time = jiffies;
6037+
nbl->nbl_time = get_seconds();
60386038
spin_lock(&nn->blocked_locks_lock);
60396039
list_add_tail(&nbl->nbl_list, &lock_sop->lo_blocked);
60406040
list_add_tail(&nbl->nbl_lru, &nn->blocked_locks_lru);

fs/nfsd/state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static inline bool nfsd4_stateid_generation_after(stateid_t *a, stateid_t *b)
591591
struct nfsd4_blocked_lock {
592592
struct list_head nbl_list;
593593
struct list_head nbl_lru;
594-
unsigned long nbl_time;
594+
time_t nbl_time;
595595
struct file_lock nbl_lock;
596596
struct knfsd_fh nbl_fh;
597597
struct nfsd4_callback nbl_cb;

0 commit comments

Comments
 (0)