From: Jeff Layton <jlayton@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Mateusz Guzik <mjguzik@gmail.com>,
Josef Bacik <josef@toxicpanda.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fs: try an opportunistic lookup for O_CREAT opens too
Date: Wed, 14 Aug 2024 12:46:32 -0400 [thread overview]
Message-ID: <0bcdf69cb17dd542d84c121cb7862dc4867f56af.camel@kernel.org> (raw)
In-Reply-To: <20240814154250.GS13701@ZenIV>
On Wed, 2024-08-14 at 16:42 +0100, Al Viro wrote:
> On Wed, Aug 14, 2024 at 07:48:17AM -0400, Jeff Layton wrote:
> > On Wed, 2024-08-14 at 03:40 +0100, Al Viro wrote:
> > > On Wed, Aug 14, 2024 at 03:18:17AM +0100, Al Viro wrote:
> > >
> > > > That's not the only problem; your "is it negative" test is
> > > > inherently
> > > > racy in RCU mode. IOW, what is positive at the time you get
> > > > here can
> > > > bloody well go negative immediately afterwards. Hit that with
> > > > O_CREAT and you've got a bogus ENOENT...
> > >
> > > Hmm... OTOH, in that case you end up in step_into(), which will
> > > do the
> > > right thing...
> > >
> > > How well does that series survive NFS client regression
> > > tests?
> > > That's where I'd expect potentially subtle shite, what with
> > > short-circuited
> > > ->d_revalidate() on the final pathwalk step in open()...
> >
> > Christian took in my v3 patch which is a bit different from this
> > one.
> > It seems to be doing fine in testing with NFS and otherwise.
> >
> > I don't think we short-circuit the d_revalidate though, do we? That
> > version calls lookup_fast on the last component which should
> > d_revalidate the last dentry before returning it.
>
> It's not about a skipped call of ->d_revalidate(); it's about the NFS
> (especially NFS4) dances inside ->d_revalidate(), where it tries to
> cut down on roundtrips where possible. The interplay with -
> >atomic_open()
> and ->open() is subtle and I'm not sure that we do not depend upon
> the
> details of ->i_rwsem locking by fs/namei.c in there - proof of
> correctness
> used to be rather convoluted there, especially wrt the unhashing and
> rehashing aliases.
>
> I'm not saying that your changes break things in there, but that's
> one
> area where I would look for trouble. NFS has fairly extensive
> regression
> tests, and it would be a good idea to beat that patchset with those.
I've already run a bunch of NFS tests on it and it seems to be OK so
far, but I'll keep testing it. My take:
Opening an extant file with O_CREAT set should behave the same as with
O_CREAT not set.
I did crawl through NFS's d_revalidate functions. There are a couple of
places that check for O_CREAT, but they didn't seem to depend on the
i_rwsem or any particular locking.
Please do let me know if you see anything I missed though.
Thanks,
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-08-14 16:46 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 14:32 [PATCH v2] fs: try an opportunistic lookup for O_CREAT opens too Jeff Layton
2024-08-06 15:25 ` Mateusz Guzik
2024-08-06 16:17 ` Jeff Layton
2024-08-06 16:42 ` Mateusz Guzik
2024-08-06 19:11 ` Andi Kleen
2024-08-06 19:22 ` Mateusz Guzik
2024-08-06 20:42 ` Jeff Layton
2024-08-06 19:26 ` Jeff Layton
2024-08-06 20:03 ` Mateusz Guzik
2024-08-06 20:47 ` Andi Kleen
2024-08-15 15:07 ` Mateusz Guzik
2024-08-06 19:51 ` Jeff Layton
2024-08-14 2:18 ` Al Viro
2024-08-14 2:40 ` Al Viro
2024-08-14 11:48 ` Jeff Layton
2024-08-14 12:40 ` Christian Brauner
2024-08-14 15:44 ` Al Viro
2024-08-16 8:34 ` Christian Brauner
2024-08-14 15:42 ` Al Viro
2024-08-14 16:46 ` Jeff Layton [this message]
2024-08-07 14:26 ` Christian Brauner
2024-08-07 14:36 ` Jeff Layton
2024-08-08 10:36 ` Christian Brauner
2024-08-08 10:54 ` Jeff Layton
2024-08-08 11:18 ` Christian Brauner
2024-08-08 17:11 ` Jan Kara
2024-08-08 21:12 ` Paul Moore
2024-08-08 23:43 ` Jeff Layton
2024-08-09 0:28 ` Paul Moore
2024-08-09 0:33 ` Jeff Layton
2024-08-09 1:22 ` Paul Moore
2024-08-09 14:21 ` Jeff Layton
2024-08-11 21:52 ` Paul Moore
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=0bcdf69cb17dd542d84c121cb7862dc4867f56af.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--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).