Skip to content

Commit

Permalink
fs/9p: Clunk the fid resulting from partial walk of the name
Browse files Browse the repository at this point in the history
Signed-off-by: Aneesh Kumar K.V <[email protected]>
Signed-off-by: Eric Van Hensbergen <[email protected]>
  • Loading branch information
kvaneesh authored and ericvh committed Apr 5, 2010
1 parent 9208d24 commit 5b0fa20
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions fs/9p/fid.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
{
int i, n, l, clone, any, access;
u32 uid;
struct p9_fid *fid;
struct p9_fid *fid, *old_fid = NULL;
struct dentry *d, *ds;
struct v9fs_session_info *v9ses;
char **wnames, *uname;
Expand Down Expand Up @@ -183,10 +183,18 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
l = min(n - i, P9_MAXWELEM);
fid = p9_client_walk(fid, l, &wnames[i], clone);
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);
return fid;
}

old_fid = fid;
i += l;
clone = 0;
}
Expand Down

0 comments on commit 5b0fa20

Please sign in to comment.