diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-04-28 08:19:23 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-04-28 08:19:23 -0400 |
commit | 22401e7b7a686bff02549cd648ba6f73f8dba868 (patch) | |
tree | 06f0b70ff09fcb9f26c4c8cfe76e4487296bebdb /fs | |
parent | 93d2269d2ffb871fdfc5555cb5d4a7c0fc56e7fe (diff) |
fuse: clean up fsync
Don't need to start I/O twice (once without i_mutex and one within).
Also make sure that even if the userspace filesystem doesn't support FSYNC
we do all the steps other than sending the message.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/file.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 3391f6a840bd..65586a567d0d 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -490,13 +490,6 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, | |||
490 | if (is_bad_inode(inode)) | 490 | if (is_bad_inode(inode)) |
491 | return -EIO; | 491 | return -EIO; |
492 | 492 | ||
493 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); | ||
494 | if (err) | ||
495 | return err; | ||
496 | |||
497 | if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) | ||
498 | return 0; | ||
499 | |||
500 | mutex_lock(&inode->i_mutex); | 493 | mutex_lock(&inode->i_mutex); |
501 | 494 | ||
502 | /* | 495 | /* |
@@ -504,7 +497,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, | |||
504 | * wait for all outstanding writes, before sending the FSYNC | 497 | * wait for all outstanding writes, before sending the FSYNC |
505 | * request. | 498 | * request. |
506 | */ | 499 | */ |
507 | err = write_inode_now(inode, 0); | 500 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
508 | if (err) | 501 | if (err) |
509 | goto out; | 502 | goto out; |
510 | 503 | ||
@@ -515,6 +508,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, | |||
515 | if (err) | 508 | if (err) |
516 | goto out; | 509 | goto out; |
517 | } | 510 | } |
511 | if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) | ||
512 | goto out; | ||
518 | 513 | ||
519 | req = fuse_get_req_nopages(fc); | 514 | req = fuse_get_req_nopages(fc); |
520 | if (IS_ERR(req)) { | 515 | if (IS_ERR(req)) { |