Commit 5cc3821b576964513f5532e0ac1efeb52f62ec6c

Authored by Al Viro
1 parent e4502c63f5

pull rehashing and unlocking the target dentry into __d_materialise_dentry()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 4 additions and 7 deletions Side-by-side Diff

... ... @@ -2636,7 +2636,6 @@
2636 2636 /*
2637 2637 * Prepare an anonymous dentry for life in the superblock's dentry tree as a
2638 2638 * named dentry in place of the dentry to be replaced.
2639   - * returns with anon->d_lock held!
2640 2639 */
2641 2640 static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2642 2641 {
2643 2642  
2644 2643  
... ... @@ -2655,21 +2654,21 @@
2655 2654 dentry->d_parent = dentry;
2656 2655 list_del_init(&dentry->d_u.d_child);
2657 2656 anon->d_parent = dparent;
  2657 + list_move(&anon->d_u.d_child, &dparent->d_subdirs);
2658 2658 if (likely(!d_unhashed(anon))) {
2659 2659 hlist_bl_lock(&anon->d_sb->s_anon);
2660 2660 __hlist_bl_del(&anon->d_hash);
2661 2661 anon->d_hash.pprev = NULL;
2662 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 2666 write_seqcount_end(&dentry->d_seq);
2667 2667 write_seqcount_end(&anon->d_seq);
2668 2668  
2669 2669 dentry_unlock_parents_for_move(anon, dentry);
2670 2670 spin_unlock(&dentry->d_lock);
2671   -
2672   - /* anon->d_lock still locked, returns locked */
  2671 + spin_unlock(&anon->d_lock);
2673 2672 }
2674 2673  
2675 2674 /**
... ... @@ -2719,8 +2718,6 @@
2719 2718 write_seqlock(&rename_lock);
2720 2719 __d_materialise_dentry(dentry, new);
2721 2720 write_sequnlock(&rename_lock);
2722   - _d_rehash(new);
2723   - spin_unlock(&new->d_lock);
2724 2721 spin_unlock(&inode->i_lock);
2725 2722 security_d_instantiate(new, inode);
2726 2723 iput(inode);
2727 2724  
... ... @@ -2811,9 +2808,9 @@
2811 2808 BUG_ON(!d_unhashed(actual));
2812 2809  
2813 2810 spin_lock(&actual->d_lock);
2814   -found:
2815 2811 _d_rehash(actual);
2816 2812 spin_unlock(&actual->d_lock);
  2813 +found:
2817 2814 spin_unlock(&inode->i_lock);
2818 2815 out_nolock:
2819 2816 if (actual == dentry) {