summaryrefslogtreecommitdiff
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-07-05 22:17:19 +0300
committerJeff Layton <jlayton@redhat.com>2017-07-06 01:44:22 +0300
commit37e51a7640c275999ea0c35410c42e6d896ff7fa (patch)
tree15188bac299755b313c6881d6d6793d0fdaab611 /mm/page-writeback.c
parent11ab83190828cb7b2cbb26467f2eecf74f0214c3 (diff)
downloadlinux-37e51a7640c275999ea0c35410c42e6d896ff7fa.tar.xz
mm: clean up error handling in write_one_page
Don't try to check PageError since that's potentially racy and not necessarily going to be set after writepage errors out. Instead, check the mapping for an error after writepage returns. That should also help us detect errors that occurred if the VM tried to clean the page earlier due to memory pressure. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index b901fe52b153..db30ce0b7d80 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2371,9 +2371,8 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
*
* The page must be locked by the caller and will be unlocked upon return.
*
- * write_one_page() returns a negative error code if I/O failed. Note that
- * the address_space is not marked for error. The caller must do this if
- * needed.
+ * Note that the mapping's AS_EIO/AS_ENOSPC flags will be cleared when this
+ * function returns.
*/
int write_one_page(struct page *page)
{
@@ -2391,15 +2390,15 @@ int write_one_page(struct page *page)
if (clear_page_dirty_for_io(page)) {
get_page(page);
ret = mapping->a_ops->writepage(page, &wbc);
- if (ret == 0) {
+ if (ret == 0)
wait_on_page_writeback(page);
- if (PageError(page))
- ret = -EIO;
- }
put_page(page);
} else {
unlock_page(page);
}
+
+ if (!ret)
+ ret = filemap_check_errors(mapping);
return ret;
}
EXPORT_SYMBOL(write_one_page);