[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200622010234.GD2040@dread.disaster.area>
Date: Mon, 22 Jun 2020 11:02:34 +1000
From: Dave Chinner <david@...morbit.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Amir Goldstein <amir73il@...il.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux MM <linux-mm@...ck.org>,
Andreas Gruenbacher <agruenba@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] Bypass filesystems for reading cached pages
On Sat, Jun 20, 2020 at 12:15:21PM -0700, Matthew Wilcox wrote:
> On Sat, Jun 20, 2020 at 09:19:37AM +0300, Amir Goldstein wrote:
> > On Fri, Jun 19, 2020 at 6:52 PM Matthew Wilcox <willy@...radead.org> wrote:
> > > This patch lifts the IOCB_CACHED idea expressed by Andreas to the VFS.
> > > The advantage of this patch is that we can avoid taking any filesystem
> > > lock, as long as the pages being accessed are in the cache (and we don't
> > > need to readahead any pages into the cache). We also avoid an indirect
> > > function call in these cases.
> >
> > XFS is taking i_rwsem lock in read_iter() for a surprising reason:
> > https://lore.kernel.org/linux-xfs/CAOQ4uxjpqDQP2AKA8Hrt4jDC65cTo4QdYDOKFE-C3cLxBBa6pQ@mail.gmail.com/
> > In that post I claim that ocfs2 and cifs also do some work in read_iter().
> > I didn't go back to check what, but it sounds like cache coherence among
> > nodes.
>
> That's out of date. Here's POSIX-2017:
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html
>
> "I/O is intended to be atomic to ordinary files and pipes and
> FIFOs. Atomic means that all the bytes from a single operation that
> started out together end up together, without interleaving from other
> I/O operations. It is a known attribute of terminals that this is not
> honored, and terminals are explicitly (and implicitly permanently)
> excepted, making the behavior unspecified. The behavior for other
> device types is also left unspecified, but the wording is intended to
> imply that future standards might choose to specify atomicity (or not)."
>
> That _doesn't_ say "a read cannot observe a write in progress". It says
> "Two writes cannot interleave". Indeed, further down in that section, it says:
Nope, it says "... without interleaving from other I/O operations".
That means read() needs to be atomic w.r.t truncate, hole punching,
extent zeroing, etc, not just other write() syscalls.
Really, though, I'm not going to get drawn into a language lawyering
argument here. We've discussed this before, and it's pretty clear
the language supports both arguments in one way or another.
And that means we are not going to change behaviour that XFS has
provided for 27 years now. Last time this came up, I said:
"XFS was designed with the intent that buffered writes are
atomic w.r.t. to all other file accesses."
Christoph said:
"Downgrading these long standing guarantees is simply not an option"
Darrick:
"I don't like the idea of adding a O_BROKENLOCKINGPONIES flag"
Nothing has changed since this was last discussed.
Well, except for the fact that since then I've seen the source code
to some 20+ year old enterprise applications that have been ported
to Linux and that has made me even more certain that we need to
maintain XFS's existing behaviour....
Cheers,
Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists