move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 11 Sep 2014 22:55:50 +0000 (18:55 -0400)
committerStricted <info@stricted.net>
Thu, 11 Oct 2018 16:04:13 +0000 (18:04 +0200)
commit 6f18493e541c690169c3b1479d47d95f624161cf upstream.

and lock the right list there

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Corey Edwards <ensabahnur16@gmail.com>
fs/dcache.c

index d525e0828659b5929d948f2c25e702f7531d010b..3e9dc2bbdd7ac8022a72071c2598b58fb2e0d671 100644 (file)
@@ -2394,6 +2394,12 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
        dentry->d_parent = dentry;
        list_del_init(&dentry->d_child);
        anon->d_parent = dparent;
+       if (likely(!d_unhashed(anon))) {
+               hlist_bl_lock(&anon->d_sb->s_anon);
+               __hlist_bl_del(&anon->d_hash);
+               anon->d_hash.pprev = NULL;
+               hlist_bl_unlock(&anon->d_sb->s_anon);
+       }
        list_move(&anon->d_child, &dparent->d_subdirs);
 
        write_seqcount_end(&dentry->d_seq);
@@ -2448,7 +2454,6 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
                                 * could splice into our tree? */
                                __d_materialise_dentry(dentry, alias);
                                write_sequnlock(&rename_lock);
-                               __d_drop(alias);
                                goto found;
                        } else {
                                /* Nope, but we must(!) avoid directory