[RHEL7,COMMIT] ms/mm: have filemap_check_and_advance_wb_err clear AS_EIO/AS_ENOSPC

Submitted by Konstantin Khorenko on June 18, 2018, 9:07 a.m.


Message ID 201806180907.w5I97gWg019959@finist_ce7.work
State New
Series "ms/mm: have filemap_check_and_advance_wb_err clear AS_EIO/AS_ENOSPC"
Headers show

Commit Message

Konstantin Khorenko June 18, 2018, 9:07 a.m.
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 be27f9ed9865bcdffdf95585b2252f36afeceb04
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Mon Jun 18 12:07:42 2018 +0300

    ms/mm: have filemap_check_and_advance_wb_err clear AS_EIO/AS_ENOSPC
    Eryu noticed that he could sometimes get a leftover error reported when
    it shouldn't be on fsync with ext2 and non-journalled ext4.
    The problem is that writeback_single_inode still uses filemap_fdatawait.
    That picks up a previously set AS_EIO flag, which would ordinarily have
    been cleared before.
    Since we're mostly using this function as a replacement for
    filemap_check_errors, have filemap_check_and_advance_wb_err clear AS_EIO
    and AS_ENOSPC when reporting an error.  That should allow the new
    function to better emulate the behavior of the old with respect to these
    Link: http://lkml.kernel.org/r/20170922133331.28812-1-jlayton@kernel.org
    Signed-off-by: Jeff Layton <jlayton@redhat.com>
    Reported-by: Eryu Guan <eguan@redhat.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (cherry picked from commit f4e222c56c83b2aed7cc2b329fca7435508eefa1)
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
 mm/filemap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/mm/filemap.c b/mm/filemap.c
index e7218a56a368..be6c37175b20 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -603,6 +603,14 @@  int file_check_and_advance_wb_err(struct file *file)
 		trace_file_check_and_advance_wb_err(file, old);
+	/*
+	 * We're mostly using this function as a drop in replacement for
+	 * filemap_check_errors. Clear AS_EIO/AS_ENOSPC to emulate the effect
+	 * that the legacy code would have had on these flags.
+	 */
+	clear_bit(AS_EIO, &mapping->flags);
+	clear_bit(AS_ENOSPC, &mapping->flags);
 	return err;