Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1592780

[PATCH 2/3] mm: don't TestClearPageError in __filemap_fdatawait_range

From Jeff Layton <jlayton@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] mm: don't TestClearPageError in __filemap_fdatawait_range
Date 2017-03-05 16:30 +0100
Message-ID <thGgF-2be-7@gated-at.bofh.it> (permalink)
References <thEHU-ZX-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The -EIO returned here can end up overriding whatever error is marked in
the address space. This means that an -ENOSPC error (AS_ENOSPC) can end
up being turned into -EIO if a page gets PG_error set on it during error
handling. Arguably, that's a bug in the writeback code, but...

Read errors are also tracked on a per page level using PG_error. Suppose
we have a read error on a page, and then that page is subsequently
dirtied by overwriting the whole page. Writeback doesn't clear PG_error,
so we can then end up successfully writing back that page and still
return -EIO on fsync.

Since the handling of this bit is somewhat inconsistent across
subsystems, let's just rely on marking the address space when there
are writeback errors.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 mm/filemap.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 3f9afded581b..2b0b4ff4668b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -375,17 +375,16 @@ int filemap_flush(struct address_space *mapping)
 }
 EXPORT_SYMBOL(filemap_flush);
 
-static int __filemap_fdatawait_range(struct address_space *mapping,
+static void __filemap_fdatawait_range(struct address_space *mapping,
 				     loff_t start_byte, loff_t end_byte)
 {
 	pgoff_t index = start_byte >> PAGE_SHIFT;
 	pgoff_t end = end_byte >> PAGE_SHIFT;
 	struct pagevec pvec;
 	int nr_pages;
-	int ret = 0;
 
 	if (end_byte < start_byte)
-		goto out;
+		return;
 
 	pagevec_init(&pvec, 0);
 	while ((index <= end) &&
@@ -402,14 +401,10 @@ static int __filemap_fdatawait_range(struct address_space *mapping,
 				continue;
 
 			wait_on_page_writeback(page);
-			if (TestClearPageError(page))
-				ret = -EIO;
 		}
 		pagevec_release(&pvec);
 		cond_resched();
 	}
-out:
-	return ret;
 }
 
 /**
@@ -429,14 +424,8 @@ static int __filemap_fdatawait_range(struct address_space *mapping,
 int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
 			    loff_t end_byte)
 {
-	int ret, ret2;
-
-	ret = __filemap_fdatawait_range(mapping, start_byte, end_byte);
-	ret2 = filemap_check_errors(mapping);
-	if (!ret)
-		ret = ret2;
-
-	return ret;
+	__filemap_fdatawait_range(mapping, start_byte, end_byte);
+	return filemap_check_errors(mapping);
 }
 EXPORT_SYMBOL(filemap_fdatawait_range);
 
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] mm/fs: get PG_error out of the writeback reporting business Jeff Layton <jlayton@redhat.com> - 2017-03-05 14:50 +0100
  [PATCH 3/3] mm: set mapping error when launder_pages fails Jeff Layton <jlayton@redhat.com> - 2017-03-05 14:50 +0100
  [PATCH 1/3] nilfs2: set the mapping error when calling SetPageError on writeback Jeff Layton <jlayton@redhat.com> - 2017-03-05 15:00 +0100
    Re: [PATCH 1/3] nilfs2: set the mapping error when calling  SetPageError on writeback Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> - 2017-03-07 17:50 +0100
  Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jeff Layton <jlayton@redhat.com> - 2017-03-05 15:50 +0100
    Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-03-07 03:00 +0100
      Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jan Kara <jack@suse.cz> - 2017-03-07 11:40 +0100
        Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jeff Layton <jlayton@redhat.com> - 2017-03-07 15:40 +0100
        Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-03-07 17:10 +0100
          Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jan Kara <jack@suse.cz> - 2017-03-07 17:50 +0100
        Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Theodore Ts'o <tytso@mit.edu> - 2017-03-09 04:00 +0100
          Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jan Kara <jack@suse.cz> - 2017-03-09 10:30 +0100
            Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jeff Layton <jlayton@redhat.com> - 2017-03-09 12:00 +0100
              Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jan Kara <jack@suse.cz> - 2017-03-09 12:10 +0100
                Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jeff Layton <jlayton@redhat.com> - 2017-03-09 13:50 +0100
                Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Brian Foster <bfoster@redhat.com> - 2017-03-09 14:30 +0100
                Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Theodore Ts'o <tytso@mit.edu> - 2017-03-09 16:10 +0100
  [PATCH 2/3] mm: don't TestClearPageError in __filemap_fdatawait_range Jeff Layton <jlayton@redhat.com> - 2017-03-05 16:30 +0100
  Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting business NeilBrown <neilb@suse.com> - 2017-03-06 04:10 +0100
    Re: [PATCH 0/3] mm/fs: get PG_error out of the writeback reporting  business Jeff Layton <jlayton@redhat.com> - 2017-03-06 12:50 +0100

csiph-web