[RHEL7,COMMIT] ms/mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails

Submitted by Konstantin Khorenko on June 9, 2018, 10:29 a.m.

Details

Message ID 201806091029.w59ATXxT024198@finist_ce7.work
State New
Series "ms/mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails"
Headers show

Commit Message

Konstantin Khorenko June 9, 2018, 10:29 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.vz7.48.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.el7
------>
commit 015b407a0c1f2fbaf9925a0eb2608abd3540eef3
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Sat Jun 9 13:29:33 2018 +0300

    ms/mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails
    
    mainline commit cbeaf95 ("mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails")
    
    filemap_write_and_wait{_range} will return an error if writeback
    initiation fails, but won't clear errors in the address_space. This is
    particularly problematic on DAX, as filemap_fdatawrite* is
    effectively synchronous there. Ensure that we clear the AS_EIO/AS_ENOSPC
    flags when filemap_fdatawrite* returns an error.
    
    Signed-off-by: Jeff Layton <jlayton@redhat.com>
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 mm/filemap.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/mm/filemap.c b/mm/filemap.c
index 438a2842af1e..09467f821631 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -520,6 +520,9 @@  int filemap_write_and_wait(struct address_space *mapping)
 			int err2 = filemap_fdatawait(mapping);
 			if (!err)
 				err = err2;
+		} else {
+			/* Clear any previously stored errors */
+			filemap_check_errors(mapping);
 		}
 	} else {
 		err = filemap_check_errors(mapping);
@@ -554,6 +557,9 @@  int filemap_write_and_wait_range(struct address_space *mapping,
 						lstart, lend);
 			if (!err)
 				err = err2;
+		} else {
+			/* Clear any previously stored errors */
+			filemap_check_errors(mapping);
 		}
 	} else {
 		err = filemap_check_errors(mapping);