[Devel] [PATCH RHEL7 COMMIT] ms/fuse: fuse_flush must check mapping->flags for errors

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 8 03:24:24 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.22.2.vz7.16.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.22.2.vz7.16.3
------>
commit 4440d619df8601d4f4a0311156ad2ca2504b60d2
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Mon Aug 8 14:24:24 2016 +0400

    ms/fuse: fuse_flush must check mapping->flags for errors
    
    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