fuse_flush() calls filemap_write_and_wait() and checks
its status, 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().

https://jira.sw.ru/browse/PSBM-49821

Signed-off-by: Maxim Patlasov <[email protected]>
---
 fs/fuse/file.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 0ef7fe1..5e73dd0 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -599,6 +599,13 @@ static int fuse_flush(struct file *file, fl_owner_t id)
        fuse_sync_writes(inode);
        mutex_unlock(&inode->i_mutex);
 
+       if (test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
+               err = -ENOSPC;
+       if (test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
+               err = -EIO;
+       if (err)
+               return err;
+
        req = fuse_get_req_nofail_nopages(fc, file);
        memset(&inarg, 0, sizeof(inarg));
        inarg.fh = ff->fh;

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to