summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-01-07 10:27:07 +0300
committerAnna Schumaker <anna.schumaker@oracle.com>2026-01-20 22:49:46 +0300
commit23e6208755cae5afd350f6805c7ea70bfd2b336d (patch)
tree77731a1fcd68959eda01d6b04c9aa63096de1915
parent9f6ddc90d5a2162ecfecbdb5f5ed5bd9f71cc65f (diff)
downloadlinux-23e6208755cae5afd350f6805c7ea70bfd2b336d.tar.xz
NFS: simplify the detached delegation check in update_open_stateid
When nfs_detach_delegation_locked detaches a delegation from an inode, it clears both nfsi->delegation and delegation->inode. Use the later in update_open_stateid to check for a detached inode, as that avoids an extra local variable, and removes the need for a RCU derefernence as we already hold the lock in the delegation. This prepares for removing the surrounding RCU critical section. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
-rw-r--r--fs/nfs/nfs4proc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5adaca5e476c..935ec446e52e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1907,7 +1907,6 @@ int update_open_stateid(struct nfs4_state *state,
{
struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs_client *clp = server->nfs_client;
- struct nfs_inode *nfsi = NFS_I(state->inode);
struct nfs_delegation *deleg_cur;
nfs4_stateid freeme = { };
int ret = 0;
@@ -1926,7 +1925,7 @@ int update_open_stateid(struct nfs4_state *state,
goto no_delegation;
spin_lock(&deleg_cur->lock);
- if (rcu_dereference(nfsi->delegation) != deleg_cur ||
+ if (!deleg_cur->inode ||
test_bit(NFS_DELEGATION_RETURNING, &deleg_cur->flags) ||
(deleg_cur->type & fmode) != fmode)
goto no_delegation_unlock;