nfsd: fix jiffies/time_t mixup in LRU list
authorArnd Bergmann <arnd@arndb.de>
Mon, 4 Nov 2019 13:43:17 +0000 (14:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:35:47 +0000 (04:35 -0800)
commite94829641e6995d04cdd13765bfa0723abf9d906
treef0fe53332f752a13c1fae144e00f81ec172e69cd
parent9f3fa8bea96d07a1a83176947493e20346422633
nfsd: fix jiffies/time_t mixup in LRU list

commit 9594497f2c78993cb66b696122f7c65528ace985 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: 7919d0a27f1e ("nfsd: add a LRU list for blocked locks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4state.c
fs/nfsd/state.h