aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-09-26 22:54:02 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-09-26 22:54:02 -0400
commit4453641fe85f2ffda653e2e61b6a554dba1f0581 (patch)
treec49d1ecccfe66aecae59ad289a55f061fc8b10ec /fs/dcache.c
parent9d8cd306a8f4cf104d5ef2e2f8f8f4f4854770a2 (diff)
__d_materialise_dentry(): flip the order of arguments
... thus making it much closer to (now unreachable, BTW) IS_ROOT(dentry) case in __d_move(). A bit more and it'll fold in. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 86afdf1376ac..0551fcc7671c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2635,38 +2635,34 @@ out_err:
2635 * Prepare an anonymous dentry for life in the superblock's dentry tree as a 2635 * Prepare an anonymous dentry for life in the superblock's dentry tree as a
2636 * named dentry in place of the dentry to be replaced. 2636 * named dentry in place of the dentry to be replaced.
2637 */ 2637 */
2638static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) 2638static void __d_materialise_dentry(struct dentry *dentry, struct dentry *target)
2639{ 2639{
2640 struct dentry *dparent; 2640 dentry_lock_for_move(dentry, target);
2641
2642 dentry_lock_for_move(anon, dentry);
2643 2641
2644 write_seqcount_begin(&dentry->d_seq); 2642 write_seqcount_begin(&dentry->d_seq);
2645 write_seqcount_begin_nested(&anon->d_seq, DENTRY_D_LOCK_NESTED); 2643 write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
2646
2647 dparent = dentry->d_parent;
2648 2644
2649 switch_names(dentry, anon); 2645 switch_names(dentry, target);
2650 swap(dentry->d_name.hash, anon->d_name.hash); 2646 swap(dentry->d_name.hash, target->d_name.hash);
2651 2647
2652 dentry->d_parent = dentry; 2648 dentry->d_parent = target->d_parent;
2653 list_del_init(&dentry->d_u.d_child); 2649 target->d_parent = target;
2654 anon->d_parent = dparent; 2650 list_del_init(&target->d_u.d_child);
2655 list_move(&anon->d_u.d_child, &dparent->d_subdirs); 2651 list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
2656 if (likely(!d_unhashed(anon))) { 2652 if (likely(!d_unhashed(dentry))) {
2657 hlist_bl_lock(&anon->d_sb->s_anon); 2653 hlist_bl_lock(&dentry->d_sb->s_anon);
2658 __hlist_bl_del(&anon->d_hash); 2654 __hlist_bl_del(&dentry->d_hash);
2659 anon->d_hash.pprev = NULL; 2655 dentry->d_hash.pprev = NULL;
2660 hlist_bl_unlock(&anon->d_sb->s_anon); 2656 hlist_bl_unlock(&dentry->d_sb->s_anon);
2661 } 2657 }
2662 __d_rehash(anon, d_hash(anon->d_parent, anon->d_name.hash)); 2658 __d_rehash(dentry, d_hash(dentry->d_parent, dentry->d_name.hash));
2663 2659
2660 write_seqcount_end(&target->d_seq);
2664 write_seqcount_end(&dentry->d_seq); 2661 write_seqcount_end(&dentry->d_seq);
2665 write_seqcount_end(&anon->d_seq);
2666 2662
2667 dentry_unlock_parents_for_move(anon, dentry); 2663 dentry_unlock_parents_for_move(dentry, target);
2664 spin_unlock(&target->d_lock);
2668 spin_unlock(&dentry->d_lock); 2665 spin_unlock(&dentry->d_lock);
2669 spin_unlock(&anon->d_lock);
2670} 2666}
2671 2667
2672/** 2668/**
@@ -2714,7 +2710,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
2714 return ERR_PTR(-EIO); 2710 return ERR_PTR(-EIO);
2715 } 2711 }
2716 write_seqlock(&rename_lock); 2712 write_seqlock(&rename_lock);
2717 __d_materialise_dentry(dentry, new); 2713 __d_materialise_dentry(new, dentry);
2718 write_sequnlock(&rename_lock); 2714 write_sequnlock(&rename_lock);
2719 spin_unlock(&inode->i_lock); 2715 spin_unlock(&inode->i_lock);
2720 security_d_instantiate(new, inode); 2716 security_d_instantiate(new, inode);
@@ -2775,7 +2771,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2775 } else if (IS_ROOT(alias)) { 2771 } else if (IS_ROOT(alias)) {
2776 /* Is this an anonymous mountpoint that we 2772 /* Is this an anonymous mountpoint that we
2777 * could splice into our tree? */ 2773 * could splice into our tree? */
2778 __d_materialise_dentry(dentry, alias); 2774 __d_materialise_dentry(alias, dentry);
2779 write_sequnlock(&rename_lock); 2775 write_sequnlock(&rename_lock);
2780 goto found; 2776 goto found;
2781 } else { 2777 } else {