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

Konstantin Khorenko khorenko at virtuozzo.com
Sat Jun 9 13:29:33 MSK 2018


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 at 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 at redhat.com>
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 mm/filemap.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);


More information about the Devel mailing list