[PATCH v3 04/11] nfs: separate locked regions in nfs_clear_verifier_directory()
From: NeilBrown
Date: Tue Aug 25 2026 - 18:21:11 EST
From: NeilBrown <neil@xxxxxxxxxx>
nfs_clear_verifier_directory() locks the dir to call
nfs_unset_verifier_delegated()
and also to walk the d_children list.
These are two separate needs and they don't need to both
be in the same locked region.
Subsequent patches will use a helper for walking the d_children list and
that helper may drop the lock temporarily. To simplify this transition,
split the locked range by dropping and retaking the lock between to make
two separate locked regions.
Signed-off-by: NeilBrown <neil@xxxxxxxxxx>
---
fs/nfs/dir.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 36f2e8588922..ef708bbb8acc 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1492,6 +1492,9 @@ static void nfs_clear_verifier_directory(struct inode *dir)
spin_lock(&this_parent->d_lock);
nfs_unset_verifier_delegated(&this_parent->d_time);
+ spin_unlock(&this_parent->d_lock);
+
+ spin_lock(&this_parent->d_lock);
dentry = d_first_child(this_parent);
hlist_for_each_entry_from(dentry, d_sib) {
if (unlikely(dentry->d_flags & DCACHE_DENTRY_CURSOR))
--
2.50.0.107.gf914562f5916.dirty