Re: [patch] aio: invalidate async directio writes
From: Zach Brown
Date: Thu Jun 19 2008 - 13:51:09 EST
> I'm utterly ignorant of all thing [AD]IO, but doesn't deferring the
> invalidate open up/widen a race window?
The case we care about making consistent are buffered reads which the
user politely only issues after O_DIRECT writes have completed.
If they issue buffered reads that race with O_DIRECT writes, well, they
get to see weird versions of the data. Just like if they issue buffered
reads that race with buffered writes.
But we must make sure that reads issued after the O_DIRECT writes are
not satisfied by cached data which was populated during a nasty racing
read. So we invalidate cached pages in the range of the write after the
O_DIRECT write is on disk but before we tell the user that the write has
completed.
This is made even worse by the observation that racing buffered reads
might be issued behind the user's back as part of read-ahead. People
have hit this very issue in systems where they have a ring buffer in a
file, an O_DIRECT writer, and a buffered reader that reads the blocks
just after they're written.
- z
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/