diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-01-07 10:27:11 +0300 |
|---|---|---|
| committer | Anna Schumaker <anna.schumaker@oracle.com> | 2026-01-20 22:49:47 +0300 |
| commit | 3365322401450971111ced702591ef78db950c28 (patch) | |
| tree | 84792b09a8258f8cd3c28eafaf3523b40580515b | |
| parent | 36e3e9387b367bd0cef3437d8181a6d6cb3c3b3f (diff) | |
| download | linux-3365322401450971111ced702591ef78db950c28.tar.xz | |
NFS: use a local RCU critical section in nfs_start_delegation_return
Nested RCU critical sections are fine and very cheap. Have a local one
in nfs_start_delegation_return so that the function is self-contained
and to prepare for simplifying the callers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
| -rw-r--r-- | fs/nfs/delegation.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index a3996bd70236..09e0d3732fda 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -309,11 +309,13 @@ nfs_start_delegation_return(struct nfs_inode *nfsi) struct nfs_delegation *delegation; bool return_now = false; - lockdep_assert_in_rcu_read_lock(); - + rcu_read_lock(); delegation = rcu_dereference(nfsi->delegation); - if (!delegation || !refcount_inc_not_zero(&delegation->refcount)) + if (!delegation || !refcount_inc_not_zero(&delegation->refcount)) { + rcu_read_unlock(); return NULL; + } + rcu_read_unlock(); spin_lock(&delegation->lock); if (delegation->inode && @@ -767,10 +769,7 @@ int nfs4_inode_return_delegation(struct inode *inode) struct nfs_delegation *delegation; int err; - rcu_read_lock(); delegation = nfs_start_delegation_return(nfsi); - rcu_read_unlock(); - if (!delegation) return 0; |
