Commit 21067527 authored by David Sheets's avatar David Sheets Committed by Miklos Szeredi

fuse: fix time_to_jiffies nsec sanity check

Commit bcb6f6d2 ("fuse: use timespec64") introduced clamped nsec values
in time_to_jiffies but used the max of nsec and NSEC_PER_SEC - 1 instead of
the min. Because of this, dentries would stay in the cache longer than
requested and go stale in scenarios that relied on their timely eviction.

Fixes: bcb6f6d2 ("fuse: use timespec64")
Signed-off-by: default avatarDavid Sheets <dsheets@docker.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org> # 4.9
parent a8a86d78
...@@ -68,7 +68,7 @@ static u64 time_to_jiffies(u64 sec, u32 nsec) ...@@ -68,7 +68,7 @@ static u64 time_to_jiffies(u64 sec, u32 nsec)
if (sec || nsec) { if (sec || nsec) {
struct timespec64 ts = { struct timespec64 ts = {
sec, sec,
max_t(u32, nsec, NSEC_PER_SEC - 1) min_t(u32, nsec, NSEC_PER_SEC - 1)
}; };
return get_jiffies_64() + timespec64_to_jiffies(&ts); return get_jiffies_64() + timespec64_to_jiffies(&ts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment