summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-04-28 14:19:23 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2014-04-28 14:19:23 +0200
commit22401e7b7a686bff02549cd648ba6f73f8dba868 (patch)
tree06f0b70ff09fcb9f26c4c8cfe76e4487296bebdb /fs
parent93d2269d2ffb871fdfc5555cb5d4a7c0fc56e7fe (diff)
downloadlinux-rpi3-22401e7b7a686bff02549cd648ba6f73f8dba868.tar.gz
linux-rpi3-22401e7b7a686bff02549cd648ba6f73f8dba868.tar.bz2
linux-rpi3-22401e7b7a686bff02549cd648ba6f73f8dba868.zip
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.c11
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,
if (is_bad_inode(inode))
return -EIO;
- err = filemap_write_and_wait_range(inode->i_mapping, start, end);
- if (err)
- return err;
-
- if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
- return 0;
-
mutex_lock(&inode->i_mutex);
/*
@@ -504,7 +497,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
* wait for all outstanding writes, before sending the FSYNC
* request.
*/
- err = write_inode_now(inode, 0);
+ err = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (err)
goto out;
@@ -515,6 +508,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
if (err)
goto out;
}
+ if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
+ goto out;
req = fuse_get_req_nopages(fc);
if (IS_ERR(req)) {