Commit af7542fc authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Eric Van Hensbergen

fs/9p: Simplify the .L create operation

Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 53c06f4e
...@@ -196,60 +196,41 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, ...@@ -196,60 +196,41 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
err); err);
goto error; goto error;
} }
/* instantiate inode and assign the unopened fid to the dentry */ /* instantiate inode and assign the unopened fid to the dentry */
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE ||
(nd && nd->flags & LOOKUP_OPEN)) {
fid = p9_client_walk(dfid, 1, &name, 1); fid = p9_client_walk(dfid, 1, &name, 1);
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
err = PTR_ERR(fid); err = PTR_ERR(fid);
P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", P9_DPRINTK(P9_DEBUG_VFS, "p9_clinet_walk failed %d\n", err);
err);
fid = NULL; fid = NULL;
goto error; goto error;
} }
inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
err = PTR_ERR(inode); err = PTR_ERR(inode);
P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
err);
goto error; goto error;
} }
d_set_d_op(dentry, &v9fs_cached_dentry_operations); if (v9ses->cache)
dentry->d_op = &v9fs_cached_dentry_operations;
else
dentry->d_op = &v9fs_dentry_operations;
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
err = v9fs_fid_add(dentry, fid); err = v9fs_fid_add(dentry, fid);
if (err < 0) if (err < 0)
goto error; goto error;
/* The fid would get clunked via a dput */
fid = NULL;
} else {
/*
* Not in cached mode. No need to populate
* inode with stat. We need to get an inode
* so that we can set the acl with dentry
*/
inode = v9fs_get_inode(dir->i_sb, mode);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto error;
}
d_set_d_op(dentry, &v9fs_dentry_operations);
d_instantiate(dentry, inode);
}
/* Now set the ACL based on the default value */ /* Now set the ACL based on the default value */
v9fs_set_create_acl(dentry, dacl, pacl); v9fs_set_create_acl(dentry, dacl, pacl);
/* if we are opening a file, assign the open fid to the file */ /* Since we are opening a file, assign the open fid to the file */
if (nd && nd->flags & LOOKUP_OPEN) {
filp = lookup_instantiate_filp(nd, dentry, generic_file_open); filp = lookup_instantiate_filp(nd, dentry, generic_file_open);
if (IS_ERR(filp)) { if (IS_ERR(filp)) {
p9_client_clunk(ofid); p9_client_clunk(ofid);
return PTR_ERR(filp); return PTR_ERR(filp);
} }
filp->private_data = ofid; filp->private_data = ofid;
} else
p9_client_clunk(ofid);
return 0; return 0;
error: error:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment