summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexey Kuznetsov <kuznet@parallels.com>2016-07-19 12:48:01 -0700
committerBen Hutchings <ben@decadent.org.uk>2016-11-20 01:17:00 +0000
commit068bbd0ba6306cc16f59ce923866bfe97355d9de (patch)
tree5d571124ec9bfd63ea2aa83cef684a600e4512d7 /fs
parent3ebde045723df3ce60a458036162ea501f1c1518 (diff)
downloadlinux-stable-068bbd0ba6306cc16f59ce923866bfe97355d9de.tar.gz
linux-stable-068bbd0ba6306cc16f59ce923866bfe97355d9de.tar.bz2
linux-stable-068bbd0ba6306cc16f59ce923866bfe97355d9de.zip
fuse: fsync() did not return IO errors
commit ac7f052b9e1534c8248f814b6f0068ad8d4a06d2 upstream. 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") Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/fuse/file.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a6442041ab64..97e860912f0b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -499,6 +499,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;