public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zach Brown <zach.brown@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jeff Moyer <jmoyer@redhat.com>,
	akpm@linux-foundation.org, linux-aio@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] aio: invalidate async directio writes
Date: Thu, 19 Jun 2008 10:50:46 -0700	[thread overview]
Message-ID: <485A9C76.8050301@oracle.com> (raw)
In-Reply-To: <1213861885.16944.255.camel@twins>


> 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

  parent reply	other threads:[~2008-06-19 17:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 18:09 [patch] aio: invalidate async directio writes Jeff Moyer
2008-06-18 18:22 ` Christoph Hellwig
2008-06-18 19:45   ` Jeff Moyer
2008-06-18 19:48     ` Christoph Hellwig
2008-06-19  7:51 ` Peter Zijlstra
2008-06-19 13:50   ` Jeff Moyer
2008-06-19 13:58     ` Peter Zijlstra
2008-06-19 14:05       ` Jeff Moyer
2008-06-19 17:50   ` Zach Brown [this message]
2008-06-19 17:23 ` Zach Brown

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=485A9C76.8050301@oracle.com \
    --to=zach.brown@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jmoyer@redhat.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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