linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: 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: Mon, 26 Jun 2017 11:11:57 -0400	[thread overview]
Message-ID: <x49y3seeqbm.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20170623101621.ggixwdjsnm7k5ch4@localhost.localdomain> (Lukas Czerner's message of "Fri, 23 Jun 2017 12:16:21 +0200")

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.

Cheers,
Jeff

  reply	other threads:[~2017-06-26 15:12 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 [this message]
2017-06-28 16:57         ` Rik van Riel
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=x49y3seeqbm.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=esandeen@redhat.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --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).