diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2010-03-19 08:47:26 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-04-05 11:37:36 -0400 |
commit | 5b0fa207d1a6f27c9a2f2d707147dce01af21db7 (patch) | |
tree | b080986b3949faa9d3b5596b4b80a94765f5ede8 /fs/9p | |
parent | 9208d24253e5e644f8cb1b87b69de44897668303 (diff) |
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.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 08b2eb15704..b0a23c7e736 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -110,7 +110,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
110 | { | 110 | { |
111 | int i, n, l, clone, any, access; | 111 | int i, n, l, clone, any, access; |
112 | u32 uid; | 112 | u32 uid; |
113 | struct p9_fid *fid; | 113 | struct p9_fid *fid, *old_fid = NULL; |
114 | struct dentry *d, *ds; | 114 | struct dentry *d, *ds; |
115 | struct v9fs_session_info *v9ses; | 115 | struct v9fs_session_info *v9ses; |
116 | char **wnames, *uname; | 116 | char **wnames, *uname; |
@@ -183,10 +183,18 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
183 | l = min(n - i, P9_MAXWELEM); | 183 | l = min(n - i, P9_MAXWELEM); |
184 | fid = p9_client_walk(fid, l, &wnames[i], clone); | 184 | fid = p9_client_walk(fid, l, &wnames[i], clone); |
185 | if (IS_ERR(fid)) { | 185 | if (IS_ERR(fid)) { |
186 | if (old_fid) { | ||
187 | /* | ||
188 | * If we fail, clunk fid which are mapping | ||
189 | * to path component and not the last component | ||
190 | * of the path. | ||
191 | */ | ||
192 | p9_client_clunk(old_fid); | ||
193 | } | ||
186 | kfree(wnames); | 194 | kfree(wnames); |
187 | return fid; | 195 | return fid; |
188 | } | 196 | } |
189 | 197 | old_fid = fid; | |
190 | i += l; | 198 | i += l; |
191 | clone = 0; | 199 | clone = 0; |
192 | } | 200 | } |