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

Submitted by Konstantin Khorenko on Dec. 17, 2018, 4:04 p.m.

Details

Message ID 201812171604.wBHG43Nd027323@finist-ce7.sw.ru
State New
Series "fuse: do not wait for completion of inessential writes in fuse fsync"
Headers show

Commit Message

Konstantin Khorenko Dec. 17, 2018, 4:04 p.m.
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@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.
    
    Affects:
    https://pmc.acronis.com/browse/VSTOR-17311
    
    Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
    Acked-By: Kirill Korotaev <dev@acronis.com>
    Acked-By: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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()