linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH] iomap: Handle I/O errors gracefully in page_mkwrite
Date: Thu,  4 Jun 2020 13:23:40 -0700	[thread overview]
Message-ID: <20200604202340.29170-1-willy@infradead.org> (raw)

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Test generic/019 often results in:

WARNING: at fs/iomap/buffered-io.c:1069 iomap_page_mkwrite_actor+0x57/0x70

Since this can happen due to a storage error, we should not WARN for it.
Just return -EIO, which will be converted to a SIGBUS for the hapless
task attempting to write to the page that we can't read.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/iomap/buffered-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 89e21961d1ad..ae6c5e38f0e8 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1066,7 +1066,8 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length,
 			return ret;
 		block_commit_write(page, 0, length);
 	} else {
-		WARN_ON_ONCE(!PageUptodate(page));
+		if (!PageUptodate(page))
+			return -EIO;
 		iomap_page_create(inode, page);
 		set_page_dirty(page);
 	}
-- 
2.26.2


             reply	other threads:[~2020-06-04 20:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 20:23 Matthew Wilcox [this message]
2020-06-04 22:57 ` [PATCH] iomap: Handle I/O errors gracefully in page_mkwrite Dave Chinner
2020-06-04 23:05   ` Matthew Wilcox
2020-06-04 23:30     ` Dave Chinner
2020-06-04 23:50       ` Matthew Wilcox
2020-06-05  0:31         ` Dave Chinner
2020-06-05  2:24           ` Matthew Wilcox
2020-06-05  3:07             ` Dave Chinner
2020-06-05 12:48               ` Matthew Wilcox
2020-06-05 16:18                 ` Darrick J. Wong
2020-06-05 21:48                 ` Dave Chinner
2020-06-05 22:49                   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604202340.29170-1-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).