mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
9p: unify paths in v9fs_vfs_lookup()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
1c5fedbb50
commit
500e2ab6c3
1 changed files with 15 additions and 20 deletions
|
@ -823,28 +823,21 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
if (IS_ERR(dfid))
|
if (IS_ERR(dfid))
|
||||||
return ERR_CAST(dfid);
|
return ERR_CAST(dfid);
|
||||||
|
|
||||||
name = dentry->d_name.name;
|
|
||||||
fid = p9_client_walk(dfid, 1, &name, 1);
|
|
||||||
if (IS_ERR(fid)) {
|
|
||||||
if (fid == ERR_PTR(-ENOENT)) {
|
|
||||||
d_add(dentry, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return ERR_CAST(fid);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Make sure we don't use a wrong inode due to parallel
|
* Make sure we don't use a wrong inode due to parallel
|
||||||
* unlink. For cached mode create calls request for new
|
* unlink. For cached mode create calls request for new
|
||||||
* inode. But with cache disabled, lookup should do this.
|
* inode. But with cache disabled, lookup should do this.
|
||||||
*/
|
*/
|
||||||
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
name = dentry->d_name.name;
|
||||||
|
fid = p9_client_walk(dfid, 1, &name, 1);
|
||||||
|
if (fid == ERR_PTR(-ENOENT))
|
||||||
|
inode = NULL;
|
||||||
|
else if (IS_ERR(fid))
|
||||||
|
inode = ERR_CAST(fid);
|
||||||
|
else if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
||||||
inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
|
inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
|
||||||
else
|
else
|
||||||
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
|
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
|
||||||
if (IS_ERR(inode)) {
|
|
||||||
p9_client_clunk(fid);
|
|
||||||
return ERR_CAST(inode);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* If we had a rename on the server and a parallel lookup
|
* If we had a rename on the server and a parallel lookup
|
||||||
* for the new name, then make sure we instantiate with
|
* for the new name, then make sure we instantiate with
|
||||||
|
@ -853,12 +846,14 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
* k/b.
|
* k/b.
|
||||||
*/
|
*/
|
||||||
res = d_splice_alias(inode, dentry);
|
res = d_splice_alias(inode, dentry);
|
||||||
|
if (!IS_ERR(fid)) {
|
||||||
if (!res)
|
if (!res)
|
||||||
v9fs_fid_add(dentry, fid);
|
v9fs_fid_add(dentry, fid);
|
||||||
else if (!IS_ERR(res))
|
else if (!IS_ERR(res))
|
||||||
v9fs_fid_add(res, fid);
|
v9fs_fid_add(res, fid);
|
||||||
else
|
else
|
||||||
p9_client_clunk(fid);
|
p9_client_clunk(fid);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue