From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Sheets Subject: [PATCH] fuse: fix time_to_jiffies nsec sanity check Date: Fri, 13 Jan 2017 15:58:30 +0000 Message-ID: <1484323110-73569-1-git-send-email-dsheets@docker.com> Cc: linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net, David Sheets To: miklos@szeredi.hu Return-path: Received: from mail-wm0-f44.google.com ([74.125.82.44]:36805 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbdAMP7F (ORCPT ); Fri, 13 Jan 2017 10:59:05 -0500 Received: by mail-wm0-f44.google.com with SMTP id c85so70761366wmi.1 for ; Fri, 13 Jan 2017 07:59:04 -0800 (PST) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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