summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-28 07:29:48 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-28 07:29:48 +0100
commita3b2157e72e321fa313389ac744bbf6d6cb6986d (patch)
tree83bbc1d8709dc609ba8c4a65d79cce9cc5d54856
parent9p: untangle ->lookup() a bit (diff)
downloadlinux-a3b2157e72e321fa313389ac744bbf6d6cb6986d.tar.xz
linux-a3b2157e72e321fa313389ac744bbf6d6cb6986d.zip
9p: make sure ->lookup() adds fid to the right dentry
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/9p/vfs_inode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 80ff01bcae3d..d86edc8d3fd0 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -824,7 +824,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
p9_client_clunk(fid);
return ERR_CAST(inode);
}
- v9fs_fid_add(dentry, fid);
/*
* If we had a rename on the server and a parallel lookup
* for the new name, then make sure we instantiate with
@@ -833,7 +832,11 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
* k/b.
*/
res = d_materialise_unique(dentry, inode);
- if (IS_ERR(res))
+ if (!res)
+ v9fs_fid_add(dentry, fid);
+ else if (!IS_ERR(res))
+ v9fs_fid_add(res, fid);
+ else
p9_client_clunk(fid);
return res;
}