aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/getroot.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/getroot.c')
-rw-r--r--fs/nfs/getroot.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index b35d2a616066..5b79ff1dd3a9 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -55,7 +55,9 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
55 return -ENOMEM; 55 return -ENOMEM;
56 } 56 }
57 /* Circumvent igrab(): we know the inode is not being freed */ 57 /* Circumvent igrab(): we know the inode is not being freed */
58 atomic_inc(&inode->i_count); 58 spin_lock(&inode->i_lock);
59 inode->i_count++;
60 spin_unlock(&inode->i_lock);
59 /* 61 /*
60 * Ensure that this dentry is invisible to d_find_alias(). 62 * Ensure that this dentry is invisible to d_find_alias().
61 * Otherwise, it may be spliced into the tree by 63 * Otherwise, it may be spliced into the tree by
@@ -64,9 +66,11 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
64 * This again causes shrink_dcache_for_umount_subtree() to 66 * This again causes shrink_dcache_for_umount_subtree() to
65 * Oops, since the test for IS_ROOT() will fail. 67 * Oops, since the test for IS_ROOT() will fail.
66 */ 68 */
67 spin_lock(&dcache_lock); 69 spin_lock(&sb->s_root->d_inode->i_lock);
70 spin_lock(&sb->s_root->d_lock);
68 list_del_init(&sb->s_root->d_alias); 71 list_del_init(&sb->s_root->d_alias);
69 spin_unlock(&dcache_lock); 72 spin_unlock(&sb->s_root->d_lock);
73 spin_unlock(&sb->s_root->d_inode->i_lock);
70 } 74 }
71 return 0; 75 return 0;
72} 76}