[Devel] [PATCH RHEL7 COMMIT] ms/fuse: fsync() does not return IO errors

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jul 19 02:20:07 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.15.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.27
------>
commit 2e8a93df0e035c066a8558e184af6c32cbe2207e
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date:   Tue Jul 19 13:20:00 2016 +0400

    ms/fuse: fsync() does not return IO errors
    
    Two bugs: one is trivial misprint, another is more serious:
    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()
    
    https://jira.sw.ru/browse/PSBM-49821
    #VSTOR-670
    
    Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    Acked-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/file.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9889e26..0ef7fe1 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -667,9 +667,19 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
 
 	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()
+	 */
+	if (test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
+		err = -ENOSPC;
+	if (test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
+		err = -EIO;
+	if (err)
+		goto out;
+
 	if (test_bit(FUSE_I_MTIME_UPDATED,
 		     &get_fuse_inode(inode)->state)) {
-		int err = fuse_flush_mtime(file, false);
+		err = fuse_flush_mtime(file, false);
 		if (err)
 			goto out;
 	}


More information about the Devel mailing list