[Devel] [PATCH rh7] fuse: fuse_flush must check mapping->flags for errors

Maxim Patlasov mpatlasov at virtuozzo.com
Tue Jul 19 17:36:48 PDT 2016


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 <mpatlasov at virtuozzo.com>
---
 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;



More information about the Devel mailing list