From patchwork Fri Jan 13 15:58:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sheets X-Patchwork-Id: 9515927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EAFA6077E for ; Fri, 13 Jan 2017 15:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22A5B28686 for ; Fri, 13 Jan 2017 15:59:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15F74286E6; Fri, 13 Jan 2017 15:59:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D68628686 for ; Fri, 13 Jan 2017 15:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750843AbdAMP7G (ORCPT ); Fri, 13 Jan 2017 10:59:06 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=docker.com; s=google; h=from:to:cc:subject:date:message-id; bh=G/3ppGDJx62gB/TgW6zcxc/4zVxF2o+fyIifFyBqErk=; b=PqPE750727UuE3DvOcmf0uuuX7WieErSkzYQ5A7T5OHlBsSoRYb1dn+sBlbWIQOAF9 eN4mY+xDTle7eN40t7ODylKpRGvvR6JsgLDH1zZ22c8U6RZGWpAxDdzb+wjtendliHG8 0l6UnWHPpSpldKSQe4N8eqg/9aXwQwytVvgKI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=G/3ppGDJx62gB/TgW6zcxc/4zVxF2o+fyIifFyBqErk=; b=iZhYdRcp/oTu0V+dzT5rpOmIQaMJWc5CJpg/LMB2zSqDgPtlqKXVPv7W2mllH91Fko KnOU34SeIp5eSlyH/LQikmdgLd+ibWhd25Eyb7EV1lqnfJ6HtLCcxZbzbXS2GRDSSTlo uuGiNWJ67zUXBdtMRcZSJT2norCuW9VyUZxSLmu6VBVuOE1xeXD4MU9xfOvjbPWmDfBZ kq3vtp8FIx7ZAa6qvmAu8MPX9hnaMpLuXGQPWbhqnnfw28sI/+zd6AgNDIFyrPC6inl8 MMkDGMR8dg7tW+VV8kev76KHyaw3AQIvJKtY5jndDI3rwJ3BDj9vP2BRjd0/bU5zcCwy 0B2g== X-Gm-Message-State: AIkVDXLCe6ns7g0TKQA9s2+LCUhD0aVPvfAKASw8jxMsnqXkxkS3vp/VrI8UPdx+9A/2ZAFr X-Received: by 10.28.173.4 with SMTP id w4mr2730299wme.70.1484323143886; Fri, 13 Jan 2017 07:59:03 -0800 (PST) Received: from Ankle-Monitor.cam.docker.com ([194.72.166.2]) by smtp.googlemail.com with ESMTPSA id w7sm5080918wmd.24.2017.01.13.07.59.02 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 Jan 2017 07:59:03 -0800 (PST) From: David Sheets X-Google-Original-From: David Sheets To: miklos@szeredi.hu Cc: linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net, 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> X-Mailer: git-send-email 2.7.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);