From: Rik van Riel <riel@redhat.com>
To: Jeff Moyer <jmoyer@redhat.com>, Jan Kara <jack@suse.cz>,
Lukas Czerner <lczerner@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
esandeen@redhat.com, Christoph Hellwig <hch@lst.de>
Subject: Re: Async direct IO write vs buffered read race
Date: Wed, 28 Jun 2017 12:57:59 -0400 [thread overview]
Message-ID: <1498669079.20270.120.camel@redhat.com> (raw)
In-Reply-To: <x49y3seeqbm.fsf@segfault.boston.devel.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2007 bytes --]
On Mon, 2017-06-26 at 11:11 -0400, Jeff Moyer wrote:
> Lukas Czerner <lczerner@redhat.com> writes:
>
> > > The thing we do is a best effort thing that more or less
> > > guarantees that if
> > > you do say buffered IO and direct IO after that, it will work
> > > reasonably.
> > > However if direct and buffered IO can race, bad luck for your
> > > data. I don't
> > > think we want to sacrifice any performance of AIO DIO (and
> > > offloading of
> > > direct IO completion to a workqueue so that we can do
> > > invalidation costs
> > > noticeable mount of performance) for supporting such usecase.
> >
> > What Jeff proposed would sacrifice performance for the case where
> > AIO
> > DIO write does race with buffered IO - the situation we agree is
> > not ideal
> > and should be avoided anyway. For the rest of AIO DIO this should
> > have no
> > effect right ? If true, I'd say this is a good effort to make sure
> > we do
> > not have disparity between page cache and disk.
>
> Exactly. Jan, are you concerned about impacting performance for
> mixed
> buffered I/O and direct writes? If so, we could look into
> restricting
> the process context switch further, to just overlapping buffered and
> direct I/O (assuming there are no locking issues).
>
> Alternatively, since we already know this is racy, we don't actually
> have to defer I/O completion to process context. We could just
> complete
> the I/O as we normally would, but also queue up an
> invalidate_inode_pages2_range work item. It will be asynchronous,
> but
> this is best effort, anyway.
>
> As Eric mentioned, the thing that bothers me is that we have invalid
> data lingering in the page cache indefinitely.
Given that the requirement is that the page cache
gets invalidated after IO completion, would it be
possible to defer only the page cache invalidation
to task context, and handle the rest of the IO
completion in interrupt context?
--
All rights reversed
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-06-28 16:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 15:57 Async direct IO write vs buffered read race Lukas Czerner
2017-06-22 16:55 ` Jeff Moyer
2017-06-23 7:59 ` Jan Kara
2017-06-23 10:16 ` Lukas Czerner
2017-06-26 15:11 ` Jeff Moyer
2017-06-28 16:57 ` Rik van Riel [this message]
2017-06-30 11:16 ` Lukas Czerner
2017-06-23 18:04 ` Eric Sandeen
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=1498669079.20270.120.camel@redhat.com \
--to=riel@redhat.com \
--cc=esandeen@redhat.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=lczerner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).