summaryrefslogtreecommitdiff
path: root/fs/9p/fid.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-06 00:42:54 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-06 00:42:54 +0400
commit749d229761ff0135cc4e16b8a28b41ae2f6b2c35 (patch)
tree25551c8cfb38319211f5ee59e78462a0f6fb85c4 /fs/9p/fid.c
parent795d580baec0d5386b83a8b557df47c20810e86b (diff)
parent3dc9fef67f6292692dba181a6d0fd0211bd0a607 (diff)
downloadlinux-749d229761ff0135cc4e16b8a28b41ae2f6b2c35.tar.xz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs: 9p: saving negative to unsigned char 9p: return on mutex_lock_interruptible() 9p: Creating files with names too long should fail with ENAMETOOLONG. 9p: Make sure we are able to clunk the cached fid on umount 9p: drop nlink remove fs/9p: Clunk the fid resulting from partial walk of the name 9p: documentation update 9p: Fix setting of protocol flags in v9fs_session_info structure.
Diffstat (limited to 'fs/9p/fid.c')
-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 82ee460e534d..7317b39b2815 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -111,7 +111,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;
@@ -184,10 +184,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;
}