aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-09-26 21:20:39 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-09-26 21:25:35 -0400
commit5cc3821b576964513f5532e0ac1efeb52f62ec6c (patch)
treef2c336555d1abffd491e501b9822b0f04e05e23a /fs
parente4502c63f56aeca887ced37f24e0def1ef11cec8 (diff)
pull rehashing and unlocking the target dentry into __d_materialise_dentry()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 7a5b51440afa..36d84ec31d8a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2636,7 +2636,6 @@ out_err:
2636/* 2636/*
2637 * Prepare an anonymous dentry for life in the superblock's dentry tree as a 2637 * Prepare an anonymous dentry for life in the superblock's dentry tree as a
2638 * named dentry in place of the dentry to be replaced. 2638 * named dentry in place of the dentry to be replaced.
2639 * returns with anon->d_lock held!
2640 */ 2639 */
2641static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) 2640static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2642{ 2641{
@@ -2655,21 +2654,21 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2655 dentry->d_parent = dentry; 2654 dentry->d_parent = dentry;
2656 list_del_init(&dentry->d_u.d_child); 2655 list_del_init(&dentry->d_u.d_child);
2657 anon->d_parent = dparent; 2656 anon->d_parent = dparent;
2657 list_move(&anon->d_u.d_child, &dparent->d_subdirs);
2658 if (likely(!d_unhashed(anon))) { 2658 if (likely(!d_unhashed(anon))) {
2659 hlist_bl_lock(&anon->d_sb->s_anon); 2659 hlist_bl_lock(&anon->d_sb->s_anon);
2660 __hlist_bl_del(&anon->d_hash); 2660 __hlist_bl_del(&anon->d_hash);
2661 anon->d_hash.pprev = NULL; 2661 anon->d_hash.pprev = NULL;
2662 hlist_bl_unlock(&anon->d_sb->s_anon); 2662 hlist_bl_unlock(&anon->d_sb->s_anon);
2663 } 2663 }
2664 list_move(&anon->d_u.d_child, &dparent->d_subdirs); 2664 __d_rehash(anon, d_hash(anon->d_parent, anon->d_name.hash));
2665 2665
2666 write_seqcount_end(&dentry->d_seq); 2666 write_seqcount_end(&dentry->d_seq);
2667 write_seqcount_end(&anon->d_seq); 2667 write_seqcount_end(&anon->d_seq);
2668 2668
2669 dentry_unlock_parents_for_move(anon, dentry); 2669 dentry_unlock_parents_for_move(anon, dentry);
2670 spin_unlock(&dentry->d_lock); 2670 spin_unlock(&dentry->d_lock);
2671 2671 spin_unlock(&anon->d_lock);
2672 /* anon->d_lock still locked, returns locked */
2673} 2672}
2674 2673
2675/** 2674/**
@@ -2719,8 +2718,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
2719 write_seqlock(&rename_lock); 2718 write_seqlock(&rename_lock);
2720 __d_materialise_dentry(dentry, new); 2719 __d_materialise_dentry(dentry, new);
2721 write_sequnlock(&rename_lock); 2720 write_sequnlock(&rename_lock);
2722 _d_rehash(new);
2723 spin_unlock(&new->d_lock);
2724 spin_unlock(&inode->i_lock); 2721 spin_unlock(&inode->i_lock);
2725 security_d_instantiate(new, inode); 2722 security_d_instantiate(new, inode);
2726 iput(inode); 2723 iput(inode);
@@ -2811,9 +2808,9 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2811 BUG_ON(!d_unhashed(actual)); 2808 BUG_ON(!d_unhashed(actual));
2812 2809
2813 spin_lock(&actual->d_lock); 2810 spin_lock(&actual->d_lock);
2814found:
2815 _d_rehash(actual); 2811 _d_rehash(actual);
2816 spin_unlock(&actual->d_lock); 2812 spin_unlock(&actual->d_lock);
2813found:
2817 spin_unlock(&inode->i_lock); 2814 spin_unlock(&inode->i_lock);
2818out_nolock: 2815out_nolock:
2819 if (actual == dentry) { 2816 if (actual == dentry) {