Skip to contentSkip to conversation

dcache: use read_seqlock_excl() in d_set_mounted()

PATCH New Waiman Long 1 participant 1 message Aug 13, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dcache: use read_seqlock_excl() in d_set_mounted()

The d_set_mounted() doesn't change anything in the filesystem other than setting the DCACHE_MOUNTED flag in the mount point's dentry which is protected by d_lock anyway. So we can safely replace write_seqlock/write_sequnlock by read_seqlock_excl/read_sequnlock_excl.

---
 fs/dcache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/dcache.c +2 -2
index 06f6585..bfdd8af 100644
@@ -1207,7 +1207,7 @@ int d_set_mounted(struct dentry *dentry)
 {
 	struct dentry *p;
 	int ret = -ENOENT;
-	write_seqlock(&rename_lock);
+	read_seqlock_excl(&rename_lock);
 	for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) {
 		/* Need exclusion wrt. check_submounts_and_drop() */
 		spin_lock(&p->d_lock);
@@ -1224,7 +1224,7 @@ int d_set_mounted(struct dentry *dentry)
 	}
  	spin_unlock(&dentry->d_lock);
 out:
-	write_sequnlock(&rename_lock);
+	read_sequnlock_excl(&rename_lock);
 	return ret;
 }
 
Signature · 1 line
1.7.1