]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
d_set_mounted(): we don't need to bump seqcount component of rename_lock
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 25 Feb 2025 18:21:14 +0000 (13:21 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 8 Jun 2025 21:47:23 +0000 (17:47 -0400)
IOW, read_seqlock_excl() is sufficient there; no need to bother
with write_seqlock() (forcing all rename_lock readers into retry).

That leaves rename_lock taken for write only when we want to change
someone's parent or name.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c

index 03d58b2d4fa346b92fd63ac90a27b0d87df7c52a..3c3cfb345233e4d2a825f59091b1901f76dd32f8 100644 (file)
@@ -1436,7 +1436,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. d_invalidate() */
                spin_lock(&p->d_lock);
@@ -1456,7 +1456,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;
 }