Skip to content

Commit 6f18493

Browse files
author
Al Viro
committed
move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)
and lock the right list there Cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent f77ced6 commit 6f18493

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/dcache.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,12 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
26562656
dentry->d_parent = dentry;
26572657
list_del_init(&dentry->d_u.d_child);
26582658
anon->d_parent = dparent;
2659+
if (likely(!d_unhashed(anon))) {
2660+
hlist_bl_lock(&anon->d_sb->s_anon);
2661+
__hlist_bl_del(&anon->d_hash);
2662+
anon->d_hash.pprev = NULL;
2663+
hlist_bl_unlock(&anon->d_sb->s_anon);
2664+
}
26592665
list_move(&anon->d_u.d_child, &dparent->d_subdirs);
26602666

26612667
write_seqcount_end(&dentry->d_seq);
@@ -2714,7 +2720,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
27142720
write_seqlock(&rename_lock);
27152721
__d_materialise_dentry(dentry, new);
27162722
write_sequnlock(&rename_lock);
2717-
__d_drop(new);
27182723
_d_rehash(new);
27192724
spin_unlock(&new->d_lock);
27202725
spin_unlock(&inode->i_lock);
@@ -2778,7 +2783,6 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
27782783
* could splice into our tree? */
27792784
__d_materialise_dentry(dentry, alias);
27802785
write_sequnlock(&rename_lock);
2781-
__d_drop(alias);
27822786
goto found;
27832787
} else {
27842788
/* Nope, but we must(!) avoid directory

0 commit comments

Comments
 (0)