Commit 689c2a89 authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by Sasha Levin

fuse: fsync() did not return IO errors

[ Upstream commit ac7f052b ]

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: default avatarAlexey Kuznetsov <kuznet@virtuozzo.com>
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 77c6ffdb
......@@ -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;
......
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