linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix silent write loss in iomap
@ 2020-09-07 20:37 Matthew Wilcox (Oracle)
  2020-09-07 20:37 ` [PATCH 1/2] iomap: Clear page error before beginning a write Matthew Wilcox (Oracle)
  2020-09-07 20:37 ` [PATCH 2/2] iomap: Mark read blocks uptodate in write_begin Matthew Wilcox (Oracle)
  0 siblings, 2 replies; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-09-07 20:37 UTC (permalink / raw)
  To: Christoph Hellwig, Darrick J . Wong
  Cc: Matthew Wilcox (Oracle), linux-xfs, linux-fsdevel

While working on the THP patchset, I decided to inject errors, and
unfortunately I found a hole in our handling of errors with non-THPs.
You can probably reproduce these errors by inserting your own error
injection for readahead pages; mine is a little too tied to the THP
patchset to post.

The basic outline of the problem is:

 - read(ahead) hits an error, page is marked Error, !Uptodate
 - write_begin succeeds at reading in page, but it is not marked
   Uptodate due to PageError being set
 - write path copies data to page, write() call returns success
 - subsequent read() sees a page which is !Uptodate, clears Error,
   calls ->readpage, re-reads data from storage, overwrites data
   from write() with old data.

The solution presented here is to behave compatibly with mm/filemap.c.
I don't _like_ how we handle PageError for read errors.  See that other
mail to linux-fsdevel for details, but this solution fixes an error that
can be hit by people with flaky storage.

I've done this as two patches because there are actually two independent
problems here.  The bug is not fixed without applying both patches, so
I'm happy to combine them into a single patch if that makes life easier.

The problem was introduced with commit 9dc55f1389f9, which made setting
PageUptodate conditional on PageError().

Matthew Wilcox (Oracle) (2):
  iomap: Clear page error before beginning a write
  iomap: Mark read blocks uptodate in write_begin

 fs/iomap/buffered-io.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-08 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 20:37 [PATCH 0/2] Fix silent write loss in iomap Matthew Wilcox (Oracle)
2020-09-07 20:37 ` [PATCH 1/2] iomap: Clear page error before beginning a write Matthew Wilcox (Oracle)
2020-09-08 14:59   ` Christoph Hellwig
2020-09-07 20:37 ` [PATCH 2/2] iomap: Mark read blocks uptodate in write_begin Matthew Wilcox (Oracle)
2020-09-08 15:03   ` Christoph Hellwig

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).