[Devel] [PATCH RHEL7 COMMIT] ms/fuse: clean up fsync

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 18 12:02:02 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.3
------>
commit 9bc0c142fb5d9d980dec115a4b7e2aca751ebd84
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Mon Jun 18 12:02:02 2018 +0300

    ms/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 at suse.cz>
    
    https://pmc.acronis.com/browse/VSTOR-10912
    (cherry picked from commit 22401e7b7a686bff02549cd648ba6f73f8dba868)
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/fuse/file.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a29e12483157..10158eb2eca0 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -696,13 +696,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);
 
 	/*
@@ -710,7 +703,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;
 
@@ -729,6 +722,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)) {


More information about the Devel mailing list