]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.7.1/fuse-fsync-did-not-return-io-errors.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.1 / fuse-fsync-did-not-return-io-errors.patch
CommitLineData
d033d661
GKH
1From ac7f052b9e1534c8248f814b6f0068ad8d4a06d2 Mon Sep 17 00:00:00 2001
2From: Alexey Kuznetsov <kuznet@parallels.com>
3Date: Tue, 19 Jul 2016 12:48:01 -0700
4Subject: fuse: fsync() did not return IO errors
5
6From: Alexey Kuznetsov <kuznet@parallels.com>
7
8commit ac7f052b9e1534c8248f814b6f0068ad8d4a06d2 upstream.
9
10Due to implementation of fuse writeback filemap_write_and_wait_range() does
11not catch errors. We have to do this directly after fuse_sync_writes()
12
13Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
14Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
15Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
16Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on")
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19---
20 fs/fuse/file.c | 15 +++++++++++++++
21 1 file changed, 15 insertions(+)
22
23--- a/fs/fuse/file.c
24+++ b/fs/fuse/file.c
25@@ -462,6 +462,21 @@ int fuse_fsync_common(struct file *file,
26 goto out;
27
28 fuse_sync_writes(inode);
29+
30+ /*
31+ * Due to implementation of fuse writeback
32+ * filemap_write_and_wait_range() does not catch errors.
33+ * We have to do this directly after fuse_sync_writes()
34+ */
35+ if (test_bit(AS_ENOSPC, &file->f_mapping->flags) &&
36+ test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
37+ err = -ENOSPC;
38+ if (test_bit(AS_EIO, &file->f_mapping->flags) &&
39+ test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
40+ err = -EIO;
41+ if (err)
42+ goto out;
43+
44 err = sync_inode_metadata(inode, 1);
45 if (err)
46 goto out;