Commit 1421e98662f1cab802e0fa39d16b8dc6b874a4eb
Exists in
master
and in
7 other branches
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
Showing 4 changed files Side-by-side Diff
fs/9p/vfs_dir.c
... | ... | @@ -292,9 +292,11 @@ |
292 | 292 | |
293 | 293 | fid = filp->private_data; |
294 | 294 | P9_DPRINTK(P9_DEBUG_VFS, |
295 | - "inode: %p filp: %p fid: %d\n", inode, filp, fid->fid); | |
295 | + "v9fs_dir_release: inode: %p filp: %p fid: %d\n", | |
296 | + inode, filp, fid ? fid->fid : -1); | |
296 | 297 | filemap_write_and_wait(inode->i_mapping); |
297 | - p9_client_clunk(fid); | |
298 | + if (fid) | |
299 | + p9_client_clunk(fid); | |
298 | 300 | return 0; |
299 | 301 | } |
300 | 302 |
fs/9p/vfs_inode.c
... | ... | @@ -730,7 +730,10 @@ |
730 | 730 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
731 | 731 | goto error; |
732 | 732 | } |
733 | - dentry->d_op = &v9fs_cached_dentry_operations; | |
733 | + if (v9ses->cache) | |
734 | + dentry->d_op = &v9fs_cached_dentry_operations; | |
735 | + else | |
736 | + dentry->d_op = &v9fs_dentry_operations; | |
734 | 737 | d_instantiate(dentry, inode); |
735 | 738 | err = v9fs_fid_add(dentry, fid); |
736 | 739 | if (err < 0) |
... | ... | @@ -1128,6 +1131,7 @@ |
1128 | 1131 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); |
1129 | 1132 | generic_fillattr(dentry->d_inode, stat); |
1130 | 1133 | |
1134 | + p9stat_free(st); | |
1131 | 1135 | kfree(st); |
1132 | 1136 | return 0; |
1133 | 1137 | } |
... | ... | @@ -1489,6 +1493,7 @@ |
1489 | 1493 | |
1490 | 1494 | retval = strnlen(buffer, buflen); |
1491 | 1495 | done: |
1496 | + p9stat_free(st); | |
1492 | 1497 | kfree(st); |
1493 | 1498 | return retval; |
1494 | 1499 | } |
... | ... | @@ -1942,7 +1947,7 @@ |
1942 | 1947 | .unlink = v9fs_vfs_unlink, |
1943 | 1948 | .mkdir = v9fs_vfs_mkdir, |
1944 | 1949 | .rmdir = v9fs_vfs_rmdir, |
1945 | - .mknod = v9fs_vfs_mknod_dotl, | |
1950 | + .mknod = v9fs_vfs_mknod, | |
1946 | 1951 | .rename = v9fs_vfs_rename, |
1947 | 1952 | .getattr = v9fs_vfs_getattr, |
1948 | 1953 | .setattr = v9fs_vfs_setattr, |
fs/9p/vfs_super.c
... | ... | @@ -122,6 +122,10 @@ |
122 | 122 | fid = v9fs_session_init(v9ses, dev_name, data); |
123 | 123 | if (IS_ERR(fid)) { |
124 | 124 | retval = PTR_ERR(fid); |
125 | + /* | |
126 | + * we need to call session_close to tear down some | |
127 | + * of the data structure setup by session_init | |
128 | + */ | |
125 | 129 | goto close_session; |
126 | 130 | } |
127 | 131 | |
... | ... | @@ -144,7 +148,6 @@ |
144 | 148 | retval = -ENOMEM; |
145 | 149 | goto release_sb; |
146 | 150 | } |
147 | - | |
148 | 151 | sb->s_root = root; |
149 | 152 | |
150 | 153 | if (v9fs_proto_dotl(v9ses)) { |
... | ... | @@ -152,7 +155,7 @@ |
152 | 155 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); |
153 | 156 | if (IS_ERR(st)) { |
154 | 157 | retval = PTR_ERR(st); |
155 | - goto clunk_fid; | |
158 | + goto release_sb; | |
156 | 159 | } |
157 | 160 | |
158 | 161 | v9fs_stat2inode_dotl(st, root->d_inode); |
... | ... | @@ -162,7 +165,7 @@ |
162 | 165 | st = p9_client_stat(fid); |
163 | 166 | if (IS_ERR(st)) { |
164 | 167 | retval = PTR_ERR(st); |
165 | - goto clunk_fid; | |
168 | + goto release_sb; | |
166 | 169 | } |
167 | 170 | |
168 | 171 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); |
169 | 172 | |
170 | 173 | |
171 | 174 | |
... | ... | @@ -174,19 +177,24 @@ |
174 | 177 | |
175 | 178 | v9fs_fid_add(root, fid); |
176 | 179 | |
177 | -P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
180 | + P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
178 | 181 | simple_set_mnt(mnt, sb); |
179 | 182 | return 0; |
180 | 183 | |
181 | 184 | clunk_fid: |
182 | 185 | p9_client_clunk(fid); |
183 | - | |
184 | 186 | close_session: |
185 | 187 | v9fs_session_close(v9ses); |
186 | 188 | kfree(v9ses); |
187 | 189 | return retval; |
188 | - | |
189 | 190 | release_sb: |
191 | + /* | |
192 | + * we will do the session_close and root dentry release | |
193 | + * in the below call. But we need to clunk fid, because we haven't | |
194 | + * attached the fid to dentry so it won't get clunked | |
195 | + * automatically. | |
196 | + */ | |
197 | + p9_client_clunk(fid); | |
190 | 198 | deactivate_locked_super(sb); |
191 | 199 | return retval; |
192 | 200 | } |
net/9p/client.c
... | ... | @@ -331,8 +331,10 @@ |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | - if (c->tagpool) | |
334 | + if (c->tagpool) { | |
335 | + p9_idpool_put(0, c->tagpool); /* free reserved tag 0 */ | |
335 | 336 | p9_idpool_destroy(c->tagpool); |
337 | + } | |
336 | 338 | |
337 | 339 | /* free requests associated with tags */ |
338 | 340 | for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { |
... | ... | @@ -944,6 +946,7 @@ |
944 | 946 | int16_t nwqids, count; |
945 | 947 | |
946 | 948 | err = 0; |
949 | + wqids = NULL; | |
947 | 950 | clnt = oldfid->clnt; |
948 | 951 | if (clone) { |
949 | 952 | fid = p9_fid_create(clnt); |
950 | 953 | |
... | ... | @@ -994,9 +997,11 @@ |
994 | 997 | else |
995 | 998 | fid->qid = oldfid->qid; |
996 | 999 | |
1000 | + kfree(wqids); | |
997 | 1001 | return fid; |
998 | 1002 | |
999 | 1003 | clunk_fid: |
1004 | + kfree(wqids); | |
1000 | 1005 | p9_client_clunk(fid); |
1001 | 1006 | fid = NULL; |
1002 | 1007 |