[Devel] [PATCH RHEL7 COMMIT] fuse: do not wait for completion of inessential writes in fuse fsync

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 17 19:04:05 MSK 2018

The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.23
commit ba105ea4a79bbd4128181fde0f346fd64740fd17
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date:   Sun Dec 16 20:42:31 2018 +0300

    fuse: do not wait for completion of inessential writes in fuse fsync
    The goal of fuse_sync_writes() in fuse_fsync_common() is to wait
    for completion of not yet finished writes from page cache
    issued by file_write_and_wait_range(). It is a distressfull feature
    of fuse: pache cache looks clean, but actually writes are not done.
    If we do not have such hidden writes, we do not need to fuse_sync_writes().
    It must have huge effect, when O_DIRECT is used and parallel writes
    are going.
    Also, as side effect, it will solve #VSTOR-17311. In fastpath
    we have another bad feature, fuse_sync_writes() waus even for completion
    of reads.
    Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    Acked-By: Kirill Korotaev <dev at acronis.com>
    Acked-By: Pavel Butsykin <pbutsykin at virtuozzo.com>
 fs/fuse/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 34a39478f93c..f05f2edd51a9 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -710,7 +710,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
 	if (err)
 		goto out;
-	fuse_sync_writes(inode);
+	if (!RB_EMPTY_ROOT(&get_fuse_inode(inode)->writepages))
+		fuse_sync_writes(inode);
 	/* Due to implementation of fuse writeback filemap_write_and_wait_range()
 	 * does not catch errors. We have to do this directly after fuse_sync_writes()

More information about the Devel mailing list