Commit 5b0fa207 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Eric Van Hensbergen

fs/9p: Clunk the fid resulting from partial walk of the name

Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 9208d242
...@@ -110,7 +110,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) ...@@ -110,7 +110,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
{ {
int i, n, l, clone, any, access; int i, n, l, clone, any, access;
u32 uid; u32 uid;
struct p9_fid *fid; struct p9_fid *fid, *old_fid = NULL;
struct dentry *d, *ds; struct dentry *d, *ds;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
char **wnames, *uname; char **wnames, *uname;
...@@ -183,10 +183,18 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) ...@@ -183,10 +183,18 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
l = min(n - i, P9_MAXWELEM); l = min(n - i, P9_MAXWELEM);
fid = p9_client_walk(fid, l, &wnames[i], clone); fid = p9_client_walk(fid, l, &wnames[i], clone);
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
if (old_fid) {
/*
* If we fail, clunk fid which are mapping
* to path component and not the last component
* of the path.
*/
p9_client_clunk(old_fid);
}
kfree(wnames); kfree(wnames);
return fid; return fid;
} }
old_fid = fid;
i += l; i += l;
clone = 0; clone = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment