aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-28 01:28:21 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-28 01:28:21 -0500
commit7b5be621993567d39f09a5190c4d651241be296f (patch)
treecc6bd3262eb8fd784f97fbd9124a828ccc00de81 /fs/9p
parent3509b678a6bb93a49d9603c9c8028c8d95019539 (diff)
9p: untangle ->lookup() a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_inode.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index cbee5ec4039d..80ff01bcae3d 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -788,7 +788,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
788 struct p9_fid *dfid, *fid; 788 struct p9_fid *dfid, *fid;
789 struct inode *inode; 789 struct inode *inode;
790 char *name; 790 char *name;
791 int result = 0;
792 791
793 p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p flags: %x\n", 792 p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p flags: %x\n",
794 dir, dentry->d_name.name, dentry, flags); 793 dir, dentry->d_name.name, dentry, flags);
@@ -806,13 +805,11 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
806 name = (char *) dentry->d_name.name; 805 name = (char *) dentry->d_name.name;
807 fid = p9_client_walk(dfid, 1, &name, 1); 806 fid = p9_client_walk(dfid, 1, &name, 1);
808 if (IS_ERR(fid)) { 807 if (IS_ERR(fid)) {
809 result = PTR_ERR(fid); 808 if (fid == ERR_PTR(-ENOENT)) {
810 if (result == -ENOENT) { 809 d_add(dentry, NULL);
811 inode = NULL; 810 return NULL;
812 goto inst_out;
813 } 811 }
814 812 return ERR_CAST(fid);
815 return ERR_PTR(result);
816 } 813 }
817 /* 814 /*
818 * Make sure we don't use a wrong inode due to parallel 815 * Make sure we don't use a wrong inode due to parallel
@@ -824,12 +821,10 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
824 else 821 else
825 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 822 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
826 if (IS_ERR(inode)) { 823 if (IS_ERR(inode)) {
827 result = PTR_ERR(inode); 824 p9_client_clunk(fid);
828 inode = NULL; 825 return ERR_CAST(inode);
829 goto error;
830 } 826 }
831 v9fs_fid_add(dentry, fid); 827 v9fs_fid_add(dentry, fid);
832inst_out:
833 /* 828 /*
834 * If we had a rename on the server and a parallel lookup 829 * If we had a rename on the server and a parallel lookup
835 * for the new name, then make sure we instantiate with 830 * for the new name, then make sure we instantiate with
@@ -838,13 +833,9 @@ inst_out:
838 * k/b. 833 * k/b.
839 */ 834 */
840 res = d_materialise_unique(dentry, inode); 835 res = d_materialise_unique(dentry, inode);
841 if (!IS_ERR(res)) 836 if (IS_ERR(res))
842 return res; 837 p9_client_clunk(fid);
843 result = PTR_ERR(res); 838 return res;
844error:
845 p9_client_clunk(fid);
846
847 return ERR_PTR(result);
848} 839}
849 840
850static int 841static int