[Devel] [PATCH RHEL7 COMMIT] ms/fuse: set mapping error in writepage_locked when it fails

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 18 12:02:00 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.3
------>
commit 942552d04cf1b1e301c3375a7dc9a77bd398ce75
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Mon Jun 18 12:02:00 2018 +0300

    ms/fuse: set mapping error in writepage_locked when it fails
    
    mainline commit 9183976e ("fuse: set mapping error in writepage_locked when it fails")
    
    This ensures that we see errors on fsync when writeback fails.
    
    Signed-off-by: Jeff Layton <jlayton at redhat.com>
    Reviewed-by: Christoph Hellwig <hch at lst.de>
    Reviewed-by: Jan Kara <jack at suse.cz>
    Signed-off-by: Miklos Szeredi <mszeredi at redhat.com>
    
    VvS:
    - 'err' variable in fuse_writepage_locked changed to 'error',
        like mainline does,
    - added mapping_set_error() into rollback to dummy_* lables
    
    https://pmc.acronis.com/browse/VSTOR-10912
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/fuse/file.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index bd57d7cf5faf..a29e12483157 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2052,7 +2052,7 @@ static int fuse_writepage_locked(struct page *page,
 	struct fuse_req *req;
 	struct page *tmp_page;
 	struct fuse_file *ff;
-	int err = 0;
+	int error = -ENOMEM;
 
 	if (fuse_page_is_writeback(inode, page->index)) {
 		if (wbc->sync_mode != WB_SYNC_ALL) {
@@ -2071,6 +2071,7 @@ static int fuse_writepage_locked(struct page *page,
 		if (test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
 			if (ff_pp)
 				*ff_pp = ff;
+			error = 0;
 			goto dummy_end_page_wb;
 		}
 
@@ -2090,6 +2091,7 @@ static int fuse_writepage_locked(struct page *page,
 	if (!tmp_page)
 		goto err_free;
 
+	error = -EIO;
 	req->ff = fuse_write_file(fc, fi);
 	if (!req->ff)
 		goto err_nofile;
@@ -2127,18 +2129,20 @@ static int fuse_writepage_locked(struct page *page,
 err_free:
 	fuse_request_free(fc, req);
 err:
+	mapping_set_error(page->mapping, error);
 	end_page_writeback(page);
-	return -ENOMEM;
+	return error;
 
 dummy_end_page_wb_err:
 	printk("FUSE: page under fwb dirtied on dead file\n");
-	err = -EIO;
+	error = -EIO;
+	mapping_set_error(page->mapping, error);
 	/* fall through ... */
 dummy_end_page_wb:
 	if (test_set_page_writeback(page))
 		BUG();
 	end_page_writeback(page);
-	return err;
+	return error;
 }
 
 static int fuse_writepage(struct page *page, struct writeback_control *wbc)


More information about the Devel mailing list