linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: fix time_to_jiffies nsec sanity check
@ 2017-01-13 15:58 David Sheets
  2017-01-13 16:21 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: David Sheets @ 2017-01-13 15:58 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, fuse-devel, 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.

Signed-off-by: David Sheets <dsheets@docker.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fuse: fix time_to_jiffies nsec sanity check
  2017-01-13 15:58 [PATCH] fuse: fix time_to_jiffies nsec sanity check David Sheets
@ 2017-01-13 16:21 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2017-01-13 16:21 UTC (permalink / raw)
  To: David Sheets; +Cc: linux-fsdevel, fuse-devel, David Sheets

On Fri, Jan 13, 2017 at 4:58 PM, David Sheets <david.sheets@docker.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-13 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 15:58 [PATCH] fuse: fix time_to_jiffies nsec sanity check David Sheets
2017-01-13 16:21 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).