diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-15 23:31:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-15 23:31:15 -0400 |
commit | 0ebc115da3ed67409792eb8de46361a5c673f072 (patch) | |
tree | 214b1a218dd84c3ac7bb66a3648fbbe41d72226b /fs | |
parent | e82e6f16a809bc47eb929c3408921def28638fcd (diff) | |
parent | b76225e22ac98070325ee2ba89473c1e1360c4cb (diff) |
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:
net/9p: nwname should be an unsigned int
9p: Fix sparse error
fs/9p: Fix error reported by coccicheck
9p: revert tsyncfs related changes
fs/9p: Use write_inode for data sync on server
fs/9p: Fix revalidate to return correct value
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/fid.c | 15 | ||||
-rw-r--r-- | fs/9p/v9fs.h | 1 | ||||
-rw-r--r-- | fs/9p/vfs_dentry.c | 4 | ||||
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 2 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 80 |
5 files changed, 62 insertions, 40 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 0ee594569dcc..85b67ffa2a43 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -286,11 +286,9 @@ static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, uid_t uid) | |||
286 | 286 | ||
287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | 287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) |
288 | { | 288 | { |
289 | int err, flags; | 289 | int err; |
290 | struct p9_fid *fid; | 290 | struct p9_fid *fid; |
291 | struct v9fs_session_info *v9ses; | ||
292 | 291 | ||
293 | v9ses = v9fs_dentry2v9ses(dentry); | ||
294 | fid = v9fs_fid_clone_with_uid(dentry, 0); | 292 | fid = v9fs_fid_clone_with_uid(dentry, 0); |
295 | if (IS_ERR(fid)) | 293 | if (IS_ERR(fid)) |
296 | goto error_out; | 294 | goto error_out; |
@@ -299,17 +297,8 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | |||
299 | * dirty pages. We always request for the open fid in read-write | 297 | * dirty pages. We always request for the open fid in read-write |
300 | * mode so that a partial page write which result in page | 298 | * mode so that a partial page write which result in page |
301 | * read can work. | 299 | * read can work. |
302 | * | ||
303 | * we don't have a tsyncfs operation for older version | ||
304 | * of protocol. So make sure the write back fid is | ||
305 | * opened in O_SYNC mode. | ||
306 | */ | 300 | */ |
307 | if (!v9fs_proto_dotl(v9ses)) | 301 | err = p9_client_open(fid, O_RDWR); |
308 | flags = O_RDWR | O_SYNC; | ||
309 | else | ||
310 | flags = O_RDWR; | ||
311 | |||
312 | err = p9_client_open(fid, flags); | ||
313 | if (err < 0) { | 302 | if (err < 0) { |
314 | p9_client_clunk(fid); | 303 | p9_client_clunk(fid); |
315 | fid = ERR_PTR(err); | 304 | fid = ERR_PTR(err); |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 9665c2b840e6..e5ebedfc5ed8 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -116,7 +116,6 @@ struct v9fs_session_info { | |||
116 | struct list_head slist; /* list of sessions registered with v9fs */ | 116 | struct list_head slist; /* list of sessions registered with v9fs */ |
117 | struct backing_dev_info bdi; | 117 | struct backing_dev_info bdi; |
118 | struct rw_semaphore rename_sem; | 118 | struct rw_semaphore rename_sem; |
119 | struct p9_fid *root_fid; /* Used for file system sync */ | ||
120 | }; | 119 | }; |
121 | 120 | ||
122 | /* cache_validity flags */ | 121 | /* cache_validity flags */ |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index b6a3b9f7fe4d..e022890c6f40 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -126,7 +126,9 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
126 | retval = v9fs_refresh_inode_dotl(fid, inode); | 126 | retval = v9fs_refresh_inode_dotl(fid, inode); |
127 | else | 127 | else |
128 | retval = v9fs_refresh_inode(fid, inode); | 128 | retval = v9fs_refresh_inode(fid, inode); |
129 | if (retval <= 0) | 129 | if (retval == -ENOENT) |
130 | return 0; | ||
131 | if (retval < 0) | ||
130 | return retval; | 132 | return retval; |
131 | } | 133 | } |
132 | out_valid: | 134 | out_valid: |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index ffbb113d5f33..82a7c38ddad0 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -811,7 +811,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) | |||
811 | fid = v9fs_fid_lookup(dentry); | 811 | fid = v9fs_fid_lookup(dentry); |
812 | if (IS_ERR(fid)) { | 812 | if (IS_ERR(fid)) { |
813 | __putname(link); | 813 | __putname(link); |
814 | link = ERR_PTR(PTR_ERR(fid)); | 814 | link = ERR_CAST(fid); |
815 | goto ndset; | 815 | goto ndset; |
816 | } | 816 | } |
817 | retval = p9_client_readlink(fid, &target); | 817 | retval = p9_client_readlink(fid, &target); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index f3eed3383e4f..feef6cdc1fd2 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -154,6 +154,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
154 | retval = PTR_ERR(inode); | 154 | retval = PTR_ERR(inode); |
155 | goto release_sb; | 155 | goto release_sb; |
156 | } | 156 | } |
157 | |||
157 | root = d_alloc_root(inode); | 158 | root = d_alloc_root(inode); |
158 | if (!root) { | 159 | if (!root) { |
159 | iput(inode); | 160 | iput(inode); |
@@ -185,21 +186,10 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
185 | p9stat_free(st); | 186 | p9stat_free(st); |
186 | kfree(st); | 187 | kfree(st); |
187 | } | 188 | } |
188 | v9fs_fid_add(root, fid); | ||
189 | retval = v9fs_get_acl(inode, fid); | 189 | retval = v9fs_get_acl(inode, fid); |
190 | if (retval) | 190 | if (retval) |
191 | goto release_sb; | 191 | goto release_sb; |
192 | /* | 192 | v9fs_fid_add(root, fid); |
193 | * Add the root fid to session info. This is used | ||
194 | * for file system sync. We want a cloned fid here | ||
195 | * so that we can do a sync_filesystem after a | ||
196 | * shrink_dcache_for_umount | ||
197 | */ | ||
198 | v9ses->root_fid = v9fs_fid_clone(root); | ||
199 | if (IS_ERR(v9ses->root_fid)) { | ||
200 | retval = PTR_ERR(v9ses->root_fid); | ||
201 | goto release_sb; | ||
202 | } | ||
203 | 193 | ||
204 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | 194 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); |
205 | return dget(sb->s_root); | 195 | return dget(sb->s_root); |
@@ -210,11 +200,15 @@ close_session: | |||
210 | v9fs_session_close(v9ses); | 200 | v9fs_session_close(v9ses); |
211 | kfree(v9ses); | 201 | kfree(v9ses); |
212 | return ERR_PTR(retval); | 202 | return ERR_PTR(retval); |
203 | |||
213 | release_sb: | 204 | release_sb: |
214 | /* | 205 | /* |
215 | * we will do the session_close and root dentry | 206 | * we will do the session_close and root dentry release |
216 | * release in the below call. | 207 | * in the below call. But we need to clunk fid, because we haven't |
208 | * attached the fid to dentry so it won't get clunked | ||
209 | * automatically. | ||
217 | */ | 210 | */ |
211 | p9_client_clunk(fid); | ||
218 | deactivate_locked_super(sb); | 212 | deactivate_locked_super(sb); |
219 | return ERR_PTR(retval); | 213 | return ERR_PTR(retval); |
220 | } | 214 | } |
@@ -232,7 +226,7 @@ static void v9fs_kill_super(struct super_block *s) | |||
232 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); | 226 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); |
233 | 227 | ||
234 | kill_anon_super(s); | 228 | kill_anon_super(s); |
235 | p9_client_clunk(v9ses->root_fid); | 229 | |
236 | v9fs_session_cancel(v9ses); | 230 | v9fs_session_cancel(v9ses); |
237 | v9fs_session_close(v9ses); | 231 | v9fs_session_close(v9ses); |
238 | kfree(v9ses); | 232 | kfree(v9ses); |
@@ -285,14 +279,6 @@ done: | |||
285 | return res; | 279 | return res; |
286 | } | 280 | } |
287 | 281 | ||
288 | static int v9fs_sync_fs(struct super_block *sb, int wait) | ||
289 | { | ||
290 | struct v9fs_session_info *v9ses = sb->s_fs_info; | ||
291 | |||
292 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_sync_fs: super_block %p\n", sb); | ||
293 | return p9_client_sync_fs(v9ses->root_fid); | ||
294 | } | ||
295 | |||
296 | static int v9fs_drop_inode(struct inode *inode) | 282 | static int v9fs_drop_inode(struct inode *inode) |
297 | { | 283 | { |
298 | struct v9fs_session_info *v9ses; | 284 | struct v9fs_session_info *v9ses; |
@@ -307,6 +293,51 @@ static int v9fs_drop_inode(struct inode *inode) | |||
307 | return 1; | 293 | return 1; |
308 | } | 294 | } |
309 | 295 | ||
296 | static int v9fs_write_inode(struct inode *inode, | ||
297 | struct writeback_control *wbc) | ||
298 | { | ||
299 | int ret; | ||
300 | struct p9_wstat wstat; | ||
301 | struct v9fs_inode *v9inode; | ||
302 | /* | ||
303 | * send an fsync request to server irrespective of | ||
304 | * wbc->sync_mode. | ||
305 | */ | ||
306 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
307 | v9inode = V9FS_I(inode); | ||
308 | if (!v9inode->writeback_fid) | ||
309 | return 0; | ||
310 | v9fs_blank_wstat(&wstat); | ||
311 | |||
312 | ret = p9_client_wstat(v9inode->writeback_fid, &wstat); | ||
313 | if (ret < 0) { | ||
314 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
315 | return ret; | ||
316 | } | ||
317 | return 0; | ||
318 | } | ||
319 | |||
320 | static int v9fs_write_inode_dotl(struct inode *inode, | ||
321 | struct writeback_control *wbc) | ||
322 | { | ||
323 | int ret; | ||
324 | struct v9fs_inode *v9inode; | ||
325 | /* | ||
326 | * send an fsync request to server irrespective of | ||
327 | * wbc->sync_mode. | ||
328 | */ | ||
329 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
330 | v9inode = V9FS_I(inode); | ||
331 | if (!v9inode->writeback_fid) | ||
332 | return 0; | ||
333 | ret = p9_client_fsync(v9inode->writeback_fid, 0); | ||
334 | if (ret < 0) { | ||
335 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
336 | return ret; | ||
337 | } | ||
338 | return 0; | ||
339 | } | ||
340 | |||
310 | static const struct super_operations v9fs_super_ops = { | 341 | static const struct super_operations v9fs_super_ops = { |
311 | .alloc_inode = v9fs_alloc_inode, | 342 | .alloc_inode = v9fs_alloc_inode, |
312 | .destroy_inode = v9fs_destroy_inode, | 343 | .destroy_inode = v9fs_destroy_inode, |
@@ -314,17 +345,18 @@ static const struct super_operations v9fs_super_ops = { | |||
314 | .evict_inode = v9fs_evict_inode, | 345 | .evict_inode = v9fs_evict_inode, |
315 | .show_options = generic_show_options, | 346 | .show_options = generic_show_options, |
316 | .umount_begin = v9fs_umount_begin, | 347 | .umount_begin = v9fs_umount_begin, |
348 | .write_inode = v9fs_write_inode, | ||
317 | }; | 349 | }; |
318 | 350 | ||
319 | static const struct super_operations v9fs_super_ops_dotl = { | 351 | static const struct super_operations v9fs_super_ops_dotl = { |
320 | .alloc_inode = v9fs_alloc_inode, | 352 | .alloc_inode = v9fs_alloc_inode, |
321 | .destroy_inode = v9fs_destroy_inode, | 353 | .destroy_inode = v9fs_destroy_inode, |
322 | .sync_fs = v9fs_sync_fs, | ||
323 | .statfs = v9fs_statfs, | 354 | .statfs = v9fs_statfs, |
324 | .drop_inode = v9fs_drop_inode, | 355 | .drop_inode = v9fs_drop_inode, |
325 | .evict_inode = v9fs_evict_inode, | 356 | .evict_inode = v9fs_evict_inode, |
326 | .show_options = generic_show_options, | 357 | .show_options = generic_show_options, |
327 | .umount_begin = v9fs_umount_begin, | 358 | .umount_begin = v9fs_umount_begin, |
359 | .write_inode = v9fs_write_inode_dotl, | ||
328 | }; | 360 | }; |
329 | 361 | ||
330 | struct file_system_type v9fs_fs_type = { | 362 | struct file_system_type v9fs_fs_type = { |