aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-01-07 08:26:58 +0100
committerAnna Schumaker <anna.schumaker@oracle.com>2026-01-20 14:49:46 -0500
commit7c80c3b8c80bc79f49c978c7d6d5166bc61816b1 (patch)
tree52cbda93c7fc16f3974696c902fcf3d35047d71b /fs
parent635879a427b855db477e293514f74ffbfa920794 (diff)
NFS: assert rcu_read_lock is held in nfs_start_delegation_return_locked
And clean up the dereference of the delegation a bit. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/delegation.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 1f899edd427f..b90d30bf7a31 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -318,10 +318,14 @@ static struct nfs_delegation *
nfs_start_delegation_return_locked(struct nfs_inode *nfsi)
{
struct nfs_delegation *ret = NULL;
- struct nfs_delegation *delegation = rcu_dereference(nfsi->delegation);
+ struct nfs_delegation *delegation;
+
+ lockdep_assert_in_rcu_read_lock();
+
+ delegation = rcu_dereference(nfsi->delegation);
+ if (!delegation)
+ return NULL;
- if (delegation == NULL)
- goto out;
spin_lock(&delegation->lock);
if (delegation->inode &&
!test_and_set_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) {
@@ -332,7 +336,6 @@ nfs_start_delegation_return_locked(struct nfs_inode *nfsi)
spin_unlock(&delegation->lock);
if (ret)
nfs_clear_verifier_delegated(&nfsi->vfs_inode);
-out:
return ret;
}