]>
Commit | Line | Data |
---|---|---|
d033d661 GKH |
1 | From ac7f052b9e1534c8248f814b6f0068ad8d4a06d2 Mon Sep 17 00:00:00 2001 |
2 | From: Alexey Kuznetsov <kuznet@parallels.com> | |
3 | Date: Tue, 19 Jul 2016 12:48:01 -0700 | |
4 | Subject: fuse: fsync() did not return IO errors | |
5 | ||
6 | From: Alexey Kuznetsov <kuznet@parallels.com> | |
7 | ||
8 | commit ac7f052b9e1534c8248f814b6f0068ad8d4a06d2 upstream. | |
9 | ||
10 | Due to implementation of fuse writeback filemap_write_and_wait_range() does | |
11 | not catch errors. We have to do this directly after fuse_sync_writes() | |
12 | ||
13 | Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com> | |
14 | Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com> | |
15 | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> | |
16 | Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on") | |
17 | Signed-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; |