aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-03-19 12:47:26 +0000
committerEric Van Hensbergen <ericvh@gmail.com>2010-04-05 10:37:36 -0500
commit5b0fa207d1a6f27c9a2f2d707147dce01af21db7 (patch)
treeb080986b3949faa9d3b5596b4b80a94765f5ede8 /fs/9p
parent9p: documentation update (diff)
downloadlinux-dev-5b0fa207d1a6f27c9a2f2d707147dce01af21db7.tar.xz
linux-dev-5b0fa207d1a6f27c9a2f2d707147dce01af21db7.zip
fs/9p: Clunk the fid resulting from partial walk of the name
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/fid.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 08b2eb157048..b0a23c7e736e 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -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;
@@ -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;
}