提交 d7dd618a 编写于 作者: C Christoph Hellwig 提交者: Linus Torvalds

knfsd: exportfs: untangle ISDIR logic in find_exported_dentry

Rework some logic in find_exported_dentry so that we only have a single
S_ISDIR check and logic that makes clear to the reader what we're really doing
here.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 10f11c34
...@@ -116,30 +116,23 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, ...@@ -116,30 +116,23 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
if (IS_ERR(result)) if (IS_ERR(result))
return result; return result;
if (S_ISDIR(result->d_inode->i_mode) && if (S_ISDIR(result->d_inode->i_mode)) {
(result->d_flags & DCACHE_DISCONNECTED)) { if (!(result->d_flags & DCACHE_DISCONNECTED)) {
/* it is an unconnected directory, we must connect it */ if (acceptable(context, result))
; return result;
} else {
if (acceptable(context, result))
return result;
if (S_ISDIR(result->d_inode->i_mode)) {
err = -EACCES; err = -EACCES;
goto err_result; goto err_result;
} }
target_dir = dget(result);
} else {
if (acceptable(context, result))
return result;
alias = find_acceptable_alias(result, acceptable, context); alias = find_acceptable_alias(result, acceptable, context);
if (alias) if (alias)
return alias; return alias;
}
/* It's a directory, or we are required to confirm the file's
* location in the tree based on the parent information
*/
dprintk("find_exported_dentry: need to look harder for %s/%d\n",sb->s_id,*(int*)obj);
if (S_ISDIR(result->d_inode->i_mode))
target_dir = dget(result);
else {
if (parent == NULL) if (parent == NULL)
goto err_result; goto err_result;
...@@ -149,6 +142,7 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, ...@@ -149,6 +142,7 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
goto err_result; goto err_result;
} }
} }
/* /*
* Now we need to make sure that target_dir is properly connected. * Now we need to make sure that target_dir is properly connected.
* It may already be, as the flag isn't always updated when connection * It may already be, as the flag isn't always updated when connection
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册