Skip to content

Commit a10db50

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
NFS: Fix an Oops in NFS unmount
Ensure that the dummy 'root dentry' is invisible to d_find_alias(). If not, then it may be spliced into the tree if a parent directory from the same filesystem gets mounted at a later time. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent a5576cf commit a10db50

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎fs/nfs/getroot.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
5757
}
5858
/* Circumvent igrab(): we know the inode is not being freed */
5959
atomic_inc(&inode->i_count);
60+
/*
61+
* Ensure that this dentry is invisible to d_find_alias().
62+
* Otherwise, it may be spliced into the tree by
63+
* d_materialise_unique if a parent directory from the same
64+
* filesystem gets mounted at a later time.
65+
* This again causes shrink_dcache_for_umount_subtree() to
66+
* Oops, since the test for IS_ROOT() will fail.
67+
*/
68+
spin_lock(&dcache_lock);
69+
list_del_init(&sb->s_root->d_alias);
70+
spin_unlock(&dcache_lock);
6071
}
6172
return 0;
6273
}

0 commit comments

Comments
 (0)