提交 ac7f052b 编写于 作者: A Alexey Kuznetsov 提交者: Miklos Szeredi

fuse: fsync() did not return IO errors

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: NAlexey Kuznetsov <kuznet@virtuozzo.com>
Signed-off-by: NMaxim Patlasov <mpatlasov@virtuozzo.com>
Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
Fixes: 4d99ff8f ("fuse: Turn writeback cache on")
Cc: <stable@vger.kernel.org> # v3.15+
上级 0f7d9341
...@@ -462,6 +462,21 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, ...@@ -462,6 +462,21 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
goto out; goto out;
fuse_sync_writes(inode); 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); err = sync_inode_metadata(inode, 1);
if (err) if (err)
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册