]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails
authorJeff Layton <jlayton@redhat.com>
Thu, 6 Jul 2017 11:02:23 +0000 (07:02 -0400)
committerJeff Layton <jlayton@redhat.com>
Thu, 6 Jul 2017 11:02:23 +0000 (07:02 -0400)
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>
mm/filemap.c

index e5711b2728f4f608f9977805797d1a22d8810191..49bc9720fb00bf22f126a0d28ed149f7ecdedb1d 100644 (file)
@@ -515,6 +515,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);
@@ -549,6 +552,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);