Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp668305pxf; Wed, 24 Mar 2021 12:54:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkwCxFKLwiiqVrAApTe6BzS0lWZb8OJ+fb6WDKB4XBevOjyJ8JvbdjvohqaRUMUeugBIG3 X-Received: by 2002:aa7:dc04:: with SMTP id b4mr5248394edu.221.1616615685038; Wed, 24 Mar 2021 12:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616615685; cv=none; d=google.com; s=arc-20160816; b=ALeagzq0q9H4d28Odb+PQtljkPE4cGz8P/to7eKx5gcXgSaCqudaALnWJo5IFHiOQy i2HKZFfCn7Eq845A/1khoPhHhmg+fAAVOtTTimfAd4KExRBXsps5IzzhrpHLED05216x i4b/8Ne0xODrLksk+4Z/OBWsG4gH5LsA7wX3c19itvwUH9XaA382CHZA8VvVuRWHzlpv LhL/Nz0KBQ80G22VgEtm93/Yogntz9/re+TgCPD2IFR+cnVko52aeTP4VhttCwqPJXz8 Mdj6ZMdp+0/DeS5jPY+kk1wH6fHOFjIkCT935r1Z/Ry4Eqr+UEl5VPweUblLnKGoHOt3 MY2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=W5eAAFKGBrO8NcTQdO/Y099fDxwXMjtg3kwSUtfS64w=; b=TYK6qJ7kYR9ZdH1woEx2Tpp6MwI0vTY45MTrrZOxP8qDXYHOksFeyn1Wbj6wvgf/vx nBW9Vxewu+rJJgm+1r+JqcLgpRXer20doIV9y9EWqopXeFn+AYbZ1bRglFV8WdYfCSgl pxFQI5+4ye5dOEJwcr6qya66w0FjBu779GtL9l4GC2L6uLHMgjJcs7bCULkyQHojjd5f nw4S69BUaVuv65/4u/96TeWjcXo2Q8thmLf8V8VDQikpwRYJuYL856jutmNkQc1UR+pI Bgs/TcVj0zVtvFBZ1A6wqhRXZ69+sUy4cvZO1txo08WNhZo2CmxfAVzyGxaYwZayB3en JxXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ddFBSCVk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si2699886ejk.446.2021.03.24.12.54.06; Wed, 24 Mar 2021 12:54:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ddFBSCVk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237935AbhCXTxW (ORCPT + 99 others); Wed, 24 Mar 2021 15:53:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:45310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbhCXTxN (ORCPT ); Wed, 24 Mar 2021 15:53:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5320C61A1D for ; Wed, 24 Mar 2021 19:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616615593; bh=FNGCzus+Rq+gR3KbHmTbx2y7A8siG2J5uwPXx5KAsxk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ddFBSCVkKSw3Fo9OBoCBvfKUfWj85EKc+MnhZ2wrAKGYbL4ZxwbNMlhQ7XHtBTeP9 q5Ze9GsklKUnt8GZVj72YFN/0KD/gv063hwyMwysL0cipfm0bHk/OL3zVG5EVqXkPD /CW5HAUMUP3noSK8Hp5aj5R8ULkyv0VVcnRPDdHzQ7GJ9//5ZcBrDVgh2FtdGOAgOM wVuLjbNUjZzFHQxjcY0FfNqz7Cgt74kZ7MzwMRzl0jimHOe1e+dXIPAVfL7yyJaYgi H3ztLcMQmrhle/Q+bNOLLjU3HGtYmzuHU9JpaBY8Fhuafx/7uWPTGxjcYF1ZfGOuqn I6blEbHziw0CA== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 2/3] NFS: Don't revalidate attributes that are not being asked for Date: Wed, 24 Mar 2021 15:53:10 -0400 Message-Id: <20210324195311.577373-2-trondmy@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324195311.577373-1-trondmy@kernel.org> References: <20210324195311.577373-1-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust If the user doesn't set STATX_UID/GID/MODE, then don't care if they are known to be stale. Ditto if we're not being asked for the file size. Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 398f814ff8f8..001a6e4aabfd 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -852,12 +852,20 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, /* Check whether the cached attributes are stale */ do_update |= force_sync || nfs_attribute_cache_expired(inode); cache_validity = READ_ONCE(NFS_I(inode)->cache_validity); - do_update |= cache_validity & - (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_LABEL); + do_update |= cache_validity & NFS_INO_INVALID_CHANGE; if (request_mask & STATX_ATIME) do_update |= cache_validity & NFS_INO_INVALID_ATIME; - if (request_mask & (STATX_CTIME|STATX_MTIME)) - do_update |= cache_validity & NFS_INO_REVAL_PAGECACHE; + if (request_mask & STATX_CTIME) + do_update |= cache_validity & + (NFS_INO_INVALID_CTIME | NFS_INO_REVAL_PAGECACHE); + if (request_mask & STATX_MTIME) + do_update |= cache_validity & + (NFS_INO_INVALID_MTIME | NFS_INO_REVAL_PAGECACHE); + if (request_mask & STATX_SIZE) + do_update |= cache_validity & + (NFS_INO_INVALID_SIZE | NFS_INO_REVAL_PAGECACHE); + if (request_mask & (STATX_UID | STATX_GID | STATX_MODE | STATX_NLINK)) + do_update |= cache_validity & NFS_INO_INVALID_OTHER; if (request_mask & STATX_BLOCKS) do_update |= cache_validity & NFS_INO_INVALID_BLOCKS; if (do_update) { -- 2.30.2