Skip to contentSkip to conversation

fuse: fix time_to_jiffies nsec sanity check

PATCH Applied David Sheets 2 participants 2 messages Jan 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: fix time_to_jiffies nsec sanity check

bcb6f6d2b9c299db32b20f4357c36a101e7f0293 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.

---
 fs/fuse/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dir.c +1 -1
index 096f799..642c57b 100644
@@ -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);
Signature · 1 line
2.7.1
maintainer Applied
#1 lore raw
Quoted 5 lines · David Sheets

bcb6f6d2b9c299db32b20f4357c36a101e7f0293 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.

Thanks, applied.

Miklos