Skip to content

Commit

Permalink
fuse: fix time_to_jiffies nsec sanity check
Browse files Browse the repository at this point in the history
Commit bcb6f6d ("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: bcb6f6d ("fuse: use timespec64")
Signed-off-by: David Sheets <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Cc: <[email protected]> # 4.9
  • Loading branch information
David Sheets authored and Miklos Szeredi committed Jan 13, 2017
1 parent a8a86d7 commit 2106752
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static u64 time_to_jiffies(u64 sec, u32 nsec)
if (sec || nsec) {
struct timespec64 ts = {
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);
Expand Down

0 comments on commit 2106752

Please sign in to comment.