diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-11 18:55:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-13 22:14:03 -0400 |
commit | 6f18493e541c690169c3b1479d47d95f624161cf (patch) | |
tree | efd828b382e5dc61ad510fdf26db7c819e91fce4 /fs/dcache.c | |
parent | f77ced6637a18d4f543458a112881776a6b7fa8c (diff) |
move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)
and lock the right list there
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index d30ce699ae4b..5c6e71dc23f5 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2656,6 +2656,12 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
2656 | dentry->d_parent = dentry; | 2656 | dentry->d_parent = dentry; |
2657 | list_del_init(&dentry->d_u.d_child); | 2657 | list_del_init(&dentry->d_u.d_child); |
2658 | anon->d_parent = dparent; | 2658 | 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 | } | ||
2659 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); | 2665 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); |
2660 | 2666 | ||
2661 | write_seqcount_end(&dentry->d_seq); | 2667 | write_seqcount_end(&dentry->d_seq); |
@@ -2714,7 +2720,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
2714 | write_seqlock(&rename_lock); | 2720 | write_seqlock(&rename_lock); |
2715 | __d_materialise_dentry(dentry, new); | 2721 | __d_materialise_dentry(dentry, new); |
2716 | write_sequnlock(&rename_lock); | 2722 | write_sequnlock(&rename_lock); |
2717 | __d_drop(new); | ||
2718 | _d_rehash(new); | 2723 | _d_rehash(new); |
2719 | spin_unlock(&new->d_lock); | 2724 | spin_unlock(&new->d_lock); |
2720 | spin_unlock(&inode->i_lock); | 2725 | spin_unlock(&inode->i_lock); |
@@ -2778,7 +2783,6 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2778 | * could splice into our tree? */ | 2783 | * could splice into our tree? */ |
2779 | __d_materialise_dentry(dentry, alias); | 2784 | __d_materialise_dentry(dentry, alias); |
2780 | write_sequnlock(&rename_lock); | 2785 | write_sequnlock(&rename_lock); |
2781 | __d_drop(alias); | ||
2782 | goto found; | 2786 | goto found; |
2783 | } else { | 2787 | } else { |
2784 | /* Nope, but we must(!) avoid directory | 2788 | /* Nope, but we must(!) avoid directory |