From: Tom Haynes <loghyr@gmail.com>
To: linux-nfs@vger.kernel.org
Cc: trondmy@kernel.org, anna@kernel.org, jlayton@kernel.org,
chuck.lever@oracle.com
Subject: [PATCH 1/1] nfs: don't skip revalidate on directory delegation when attrs flagged stale
Date: Sat, 18 Apr 2026 12:03:01 -0700 [thread overview]
Message-ID: <20260418190301.3661-2-loghyr@gmail.com> (raw)
In-Reply-To: <20260418190301.3661-1-loghyr@gmail.com>
On a local directory mutation (rename/create/unlink) the client marks
CHANGE / MTIME / CTIME as invalid in NFS_I(dir)->cache_validity. When
a subsequent stat(2) enters __nfs_revalidate_inode() and finds a
directory delegation held, the function currently early-exits and
returns the cached (now stale) mtime to userspace without sending a
GETATTR RPC.
Keep the early-exit for the fast path, but take the RPC when CHANGE,
MTIME, or CTIME are already marked invalid. The delegation alone is
not a guarantee of cached-attr freshness once the code itself has
flagged the cache as stale.
Assisted-by: Claude:claude-opus-4-7 [bpftrace] [tshark]
Signed-off-by: Tom Haynes <loghyr@gmail.com>
---
fs/nfs/inode.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 98a8f0de1199..936bc329f462 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1390,7 +1390,11 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
status = pnfs_sync_inode(inode, false);
if (status)
goto out;
- } else if (nfs_have_directory_delegation(inode)) {
+ } else if (nfs_have_directory_delegation(inode) &&
+ !(NFS_I(inode)->cache_validity &
+ (NFS_INO_INVALID_CHANGE |
+ NFS_INO_INVALID_MTIME |
+ NFS_INO_INVALID_CTIME))) {
status = 0;
goto out;
}
--
2.53.0
next prev parent reply other threads:[~2026-04-18 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 19:03 [PATCH 0/1] nfs: fix directory mtime staleness under directory delegation after local mutations Tom Haynes
2026-04-18 19:03 ` Tom Haynes [this message]
2026-04-23 13:37 ` [PATCH 1/1] nfs: don't skip revalidate on directory delegation when attrs flagged stale Anna Schumaker
2026-04-23 14:29 ` Thomas Haynes
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=20260418190301.3661-2-loghyr@gmail.com \
--to=loghyr@gmail.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.