[PATCH] fuse: fix time_to_jiffies nsec sanity check

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] fuse: fix time_to_jiffies nsec sanity check

David Sheets-2
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.

Signed-off-by: David Sheets <[hidden email]>
---
 fs/fuse/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 096f799..642c57b 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -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);
--
2.7.1


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] fuse: fix time_to_jiffies nsec sanity check

Miklos Szeredi
On Fri, Jan 13, 2017 at 4:58 PM, David Sheets <[hidden email]> wrote:
> 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

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Loading...