diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-01-07 10:27:06 +0300 |
|---|---|---|
| committer | Anna Schumaker <anna.schumaker@oracle.com> | 2026-01-20 22:49:46 +0300 |
| commit | 9f6ddc90d5a2162ecfecbdb5f5ed5bd9f71cc65f (patch) | |
| tree | 75ae01bab51a545e26c16ba14e5982579916b0b1 | |
| parent | 8f7e0b808067afaca0d370c49824c5393101302c (diff) | |
| download | linux-9f6ddc90d5a2162ecfecbdb5f5ed5bd9f71cc65f.tar.xz | |
NFS: move the deleg_cur check out of nfs_detach_delegation_locked
nfs_inode_set_delegation as the only direct caller of
nfs_detach_delegation_locked already check this under cl_lock, so
don't repeat it.
Replace the lockdep coverage for the lock that was implicitly provided by
the rcu_dereference_protected call that is removed with an explicit
lockdep assert to keep the coverage.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
| -rw-r--r-- | fs/nfs/delegation.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 762d79ee58e3..a64c30efa1a3 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -350,15 +350,10 @@ nfs_detach_delegation_locked(struct nfs_inode *nfsi, struct nfs_delegation *delegation, struct nfs_client *clp) { - struct nfs_delegation *deleg_cur = - rcu_dereference_protected(nfsi->delegation, - lockdep_is_held(&clp->cl_lock)); + lockdep_assert_held(&clp->cl_lock); trace_nfs4_detach_delegation(&nfsi->vfs_inode, delegation->type); - if (delegation != deleg_cur) - return false; - spin_lock(&delegation->lock); if (!delegation->inode) { spin_unlock(&delegation->lock); @@ -378,10 +373,14 @@ static bool nfs_detach_delegation(struct nfs_inode *nfsi, struct nfs_server *server) { struct nfs_client *clp = server->nfs_client; - bool ret; + struct nfs_delegation *deleg_cur; + bool ret = false; spin_lock(&clp->cl_lock); - ret = nfs_detach_delegation_locked(nfsi, delegation, clp); + deleg_cur = rcu_dereference_protected(nfsi->delegation, + lockdep_is_held(&clp->cl_lock)); + if (delegation == deleg_cur) + ret = nfs_detach_delegation_locked(nfsi, delegation, clp); spin_unlock(&clp->cl_lock); return ret; } |
