linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sheets <david.sheets@docker.com>
To: miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net,
	David Sheets <dsheets@docker.com>
Subject: [PATCH] fuse: fix time_to_jiffies nsec sanity check
Date: Fri, 13 Jan 2017 15:58:30 +0000	[thread overview]
Message-ID: <1484323110-73569-1-git-send-email-dsheets@docker.com> (raw)

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


             reply	other threads:[~2017-01-13 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 15:58 David Sheets [this message]
2017-01-13 16:21 ` [PATCH] fuse: fix time_to_jiffies nsec sanity check Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484323110-73569-1-git-send-email-dsheets@docker.com \
    --to=david.sheets@docker.com \
    --cc=dsheets@docker.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).