提交 a3f432bf 编写于 作者: J J. Bruce Fields 提交者: Trond Myklebust

nfs: use IS_ROOT not DCACHE_DISCONNECTED

This check was added by Al Viro with
d9e80b7d "nfs d_revalidate() is too
trigger-happy with d_drop()", with the explanation that we don't want to
remove the root of a disconnected tree, which will still be included on
the s_anon list.

But DCACHE_DISCONNECTED does *not* actually identify dentries that are
disconnected from the dentry tree or hashed on s_anon.  IS_ROOT() is the
way to do that.

Also add a comment from Al's commit to remind us why this check is
there.
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 9d3a2260
......@@ -1139,7 +1139,13 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
if (inode && S_ISDIR(inode->i_mode)) {
/* Purge readdir caches. */
nfs_zap_caches(inode);
if (dentry->d_flags & DCACHE_DISCONNECTED)
/*
* We can't d_drop the root of a disconnected tree:
* its d_hash is on the s_anon list and d_drop() would hide
* it from shrink_dcache_for_unmount(), leading to busy
* inodes on unmount and further oopses.
*/
if (IS_ROOT(dentry))
goto out_valid;
}
/* If we have submounts, don't unhash ! */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册