Commit 1421e986 authored by Linus Torvalds's avatar Linus Torvalds

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:
  fs/9p: Don't use dotl version of mknod for dotu inode operations
  fs/9p: Use the correct dentry operations
  9p: Check for NULL fid in v9fs_dir_release()
  fs/9p: Fix error handling in v9fs_get_sb
  fs/9p, net/9p: memory leak fixes
parents 2bb3a259 1d76e313
...@@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) ...@@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
fid = filp->private_data; fid = filp->private_data;
P9_DPRINTK(P9_DEBUG_VFS, P9_DPRINTK(P9_DEBUG_VFS,
"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid); "v9fs_dir_release: inode: %p filp: %p fid: %d\n",
inode, filp, fid ? fid->fid : -1);
filemap_write_and_wait(inode->i_mapping); filemap_write_and_wait(inode->i_mapping);
p9_client_clunk(fid); if (fid)
p9_client_clunk(fid);
return 0; return 0;
} }
......
...@@ -730,7 +730,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int mode, ...@@ -730,7 +730,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int mode,
P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
goto error; goto error;
} }
dentry->d_op = &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)
...@@ -1128,6 +1131,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -1128,6 +1131,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb);
generic_fillattr(dentry->d_inode, stat); generic_fillattr(dentry->d_inode, stat);
p9stat_free(st);
kfree(st); kfree(st);
return 0; return 0;
} }
...@@ -1489,6 +1493,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) ...@@ -1489,6 +1493,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
retval = strnlen(buffer, buflen); retval = strnlen(buffer, buflen);
done: done:
p9stat_free(st);
kfree(st); kfree(st);
return retval; return retval;
} }
...@@ -1942,7 +1947,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { ...@@ -1942,7 +1947,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = {
.unlink = v9fs_vfs_unlink, .unlink = v9fs_vfs_unlink,
.mkdir = v9fs_vfs_mkdir, .mkdir = v9fs_vfs_mkdir,
.rmdir = v9fs_vfs_rmdir, .rmdir = v9fs_vfs_rmdir,
.mknod = v9fs_vfs_mknod_dotl, .mknod = v9fs_vfs_mknod,
.rename = v9fs_vfs_rename, .rename = v9fs_vfs_rename,
.getattr = v9fs_vfs_getattr, .getattr = v9fs_vfs_getattr,
.setattr = v9fs_vfs_setattr, .setattr = v9fs_vfs_setattr,
......
...@@ -122,6 +122,10 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -122,6 +122,10 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
fid = v9fs_session_init(v9ses, dev_name, data); fid = v9fs_session_init(v9ses, dev_name, data);
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
retval = PTR_ERR(fid); retval = PTR_ERR(fid);
/*
* we need to call session_close to tear down some
* of the data structure setup by session_init
*/
goto close_session; goto close_session;
} }
...@@ -144,7 +148,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -144,7 +148,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
retval = -ENOMEM; retval = -ENOMEM;
goto release_sb; goto release_sb;
} }
sb->s_root = root; sb->s_root = root;
if (v9fs_proto_dotl(v9ses)) { if (v9fs_proto_dotl(v9ses)) {
...@@ -152,7 +155,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -152,7 +155,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
if (IS_ERR(st)) { if (IS_ERR(st)) {
retval = PTR_ERR(st); retval = PTR_ERR(st);
goto clunk_fid; goto release_sb;
} }
v9fs_stat2inode_dotl(st, root->d_inode); v9fs_stat2inode_dotl(st, root->d_inode);
...@@ -162,7 +165,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -162,7 +165,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
st = p9_client_stat(fid); st = p9_client_stat(fid);
if (IS_ERR(st)) { if (IS_ERR(st)) {
retval = PTR_ERR(st); retval = PTR_ERR(st);
goto clunk_fid; goto release_sb;
} }
root->d_inode->i_ino = v9fs_qid2ino(&st->qid); root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
...@@ -174,19 +177,24 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -174,19 +177,24 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
v9fs_fid_add(root, fid); v9fs_fid_add(root, fid);
P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
simple_set_mnt(mnt, sb); simple_set_mnt(mnt, sb);
return 0; return 0;
clunk_fid: clunk_fid:
p9_client_clunk(fid); p9_client_clunk(fid);
close_session: close_session:
v9fs_session_close(v9ses); v9fs_session_close(v9ses);
kfree(v9ses); kfree(v9ses);
return retval; return retval;
release_sb: release_sb:
/*
* we will do the session_close and root dentry release
* in the below call. But we need to clunk fid, because we haven't
* attached the fid to dentry so it won't get clunked
* automatically.
*/
p9_client_clunk(fid);
deactivate_locked_super(sb); deactivate_locked_super(sb);
return retval; return retval;
} }
......
...@@ -331,8 +331,10 @@ static void p9_tag_cleanup(struct p9_client *c) ...@@ -331,8 +331,10 @@ static void p9_tag_cleanup(struct p9_client *c)
} }
} }
if (c->tagpool) if (c->tagpool) {
p9_idpool_put(0, c->tagpool); /* free reserved tag 0 */
p9_idpool_destroy(c->tagpool); p9_idpool_destroy(c->tagpool);
}
/* free requests associated with tags */ /* free requests associated with tags */
for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
...@@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, ...@@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
int16_t nwqids, count; int16_t nwqids, count;
err = 0; err = 0;
wqids = NULL;
clnt = oldfid->clnt; clnt = oldfid->clnt;
if (clone) { if (clone) {
fid = p9_fid_create(clnt); fid = p9_fid_create(clnt);
...@@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, ...@@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
else else
fid->qid = oldfid->qid; fid->qid = oldfid->qid;
kfree(wqids);
return fid; return fid;
clunk_fid: clunk_fid:
kfree(wqids);
p9_client_clunk(fid); p9_client_clunk(fid);
fid = NULL; fid = NULL;
......
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