summaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorMaxim Patlasov <mpatlasov@virtuozzo.com>2016-07-19 21:12:26 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-07-29 08:10:57 -0400
commit9ebce595f63a407c5cec98f98f9da8459b73740a (patch)
tree48c65e0bd9fa2c98258b7d5c032fdf9591c291d8 /fs/fuse/file.c
parentac7f052b9e1534c8248f814b6f0068ad8d4a06d2 (diff)
fuse: fuse_flush must check mapping->flags for errors
fuse_flush() calls write_inode_now() that triggers writeback, but actual writeback will happen later, on fuse_sync_writes(). If an error happens, fuse_writepage_end() will set error bit in mapping->flags. So, we have to check mapping->flags after fuse_sync_writes(). 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+
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 2491f388358b..594fb15fba9b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id)
417 fuse_sync_writes(inode); 417 fuse_sync_writes(inode);
418 inode_unlock(inode); 418 inode_unlock(inode);
419 419
420 if (test_bit(AS_ENOSPC, &file->f_mapping->flags) &&
421 test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
422 err = -ENOSPC;
423 if (test_bit(AS_EIO, &file->f_mapping->flags) &&
424 test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
425 err = -EIO;
426 if (err)
427 return err;
428
420 req = fuse_get_req_nofail_nopages(fc, file); 429 req = fuse_get_req_nofail_nopages(fc, file);
421 memset(&inarg, 0, sizeof(inarg)); 430 memset(&inarg, 0, sizeof(inarg));
422 inarg.fh = ff->fh; 431 inarg.fh = ff->fh;