diff options
| author | Tom Haynes <loghyr@gmail.com> | 2026-04-18 22:03:01 +0300 |
|---|---|---|
| committer | Anna Schumaker <anna.schumaker@hammerspace.com> | 2026-06-15 22:06:06 +0300 |
| commit | 84800a8d1d22c475b3c35bdbcf8ed64a55f3b66f (patch) | |
| tree | 5c19ce9c78923c527ad8a768bff0f4a0fe650964 | |
| parent | 60e7870052f417d83965db144f70ae21fcfcf37f (diff) | |
| download | linux-84800a8d1d22c475b3c35bdbcf8ed64a55f3b66f.tar.xz | |
nfs: don't skip revalidate on directory delegation when attrs flagged stale
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>
[Anna: Use NFS_INO_INVALID_ATTR insteado of individual NFS_INO_INVALID_* flags]
Signed-off-by: Anna Schumaker <anna@kernel.org>
| -rw-r--r-- | fs/nfs/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 0d9451a2ad8e..c6c939a76722 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1357,7 +1357,8 @@ __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_ATTR)) { status = 0; goto out; } |
