]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
fuse: fsync() did not return IO errors
authorAlexey Kuznetsov <kuznet@parallels.com>
Tue, 19 Jul 2016 19:48:01 +0000 (12:48 -0700)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 29 Jul 2016 12:10:57 +0000 (14:10 +0200)
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()

Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on")
Cc: <stable@vger.kernel.org> # v3.15+
fs/fuse/file.c

index 7270e89880b59ec6edec70cafa0c7c052b99fb44..2491f388358baa0c44db0b460bfb2e0ac735428f 100644 (file)
@@ -462,6 +462,21 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
                goto out;
 
        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_bit(AS_ENOSPC, &file->f_mapping->flags) &&
+           test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
+               err = -ENOSPC;
+       if (test_bit(AS_EIO, &file->f_mapping->flags) &&
+           test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
+               err = -EIO;
+       if (err)
+               goto out;
+
        err = sync_inode_metadata(inode, 1);
        if (err)
                goto out;