Commit 614c3393 authored by Maxim Patlasov's avatar Maxim Patlasov Committed by Sasha Levin

fuse: fuse_flush must check mapping->flags for errors

[ Upstream commit 9ebce595 ]

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: default avatarMaxim Patlasov <mpatlasov@virtuozzo.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Fixes: 4d99ff8f ("fuse: Turn writeback cache on")
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 3fc4a4a2
...@@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id) ...@@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id)
fuse_sync_writes(inode); fuse_sync_writes(inode);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
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)
return err;
req = fuse_get_req_nofail_nopages(fc, file); req = fuse_get_req_nofail_nopages(fc, file);
memset(&inarg, 0, sizeof(inarg)); memset(&inarg, 0, sizeof(inarg));
inarg.fh = ff->fh; inarg.fh = ff->fh;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment