[PATCH v2 04/18] nfs: separate locked regions in nfs_clear_verifier_directory()

NeilBrown <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,org.kernel.vger.autofs,org.kernel.vger.ceph-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs
Message-ID <[email protected]>
From: NeilBrown <[email protected]>

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 <[email protected]>
---
 fs/nfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c7caffb31935..bba5d996413c 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.