Re: [PATCH] Fix bad data from non-direct-io read after direct-io write

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Karl Schendel <kschendel@...>, Zach Brown <zach.brown@...>, Benjamin LaHaise <bcrl@...>, Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Nick Piggin <nickpiggin@...>, Leonid Ananiev <leonid.i.ananiev@...>, Chris Mason <chris.mason@...>
Date: Friday, October 26, 2007 - 6:30 pm

Linus Torvalds wrote:

Agreed.  And it's a really dumb bug.  ->direct_io will almost always
return -EIOCBQUEUED for aio dio so it won't be invalidating for aio dio
writes.  (Notice that the testing in that commit mentions two racing
processes, I bet U$1M that I only tested sync dio :/)

I think that test should be changed to

  if (retval < 0 && retval != -EIOCBQUEUED)
	goto out;



If the invalidation fails then the app is left with stale data in the
page cache and current data on disk.  The return code corruption you're
referring to was intended to communicate this scary situation to the app
with EIO.

It sucks.  Does it suck more than returning success for the dio write
when later buffered reads will return stale data?  I dunno.  What does
the peanut gallery think?


Chris (Mason) and I certainly love the idea of getting rid of
fs/direct-io.c.  Getting O_DIRECT working with the page-granular
buffered locking rules while doing large IOs (and, as far as I know,
potentially sector-granular) without noticeable performance regressions
is a mess.

- z
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Fix bad data from non-direct-io read after direc..., Zach Brown, (Fri Oct 26, 6:30 pm)