From: Vivek Goyal <vgoyal@redhat.com>
To: Bernd Schubert <bschubert@ddn.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Dharmendra Singh <dharamhans87@gmail.com>
Subject: Re: [RFC PATCH] vfs: allow ->atomic_open() on positive
Date: Thu, 19 May 2022 16:50:52 -0400 [thread overview]
Message-ID: <YoatrAK9sWiTZ/1z@redhat.com> (raw)
In-Reply-To: <016ca19d-41b8-a69f-42f1-1805a40fd611@ddn.com>
On Thu, May 19, 2022 at 10:43:54PM +0200, Bernd Schubert wrote:
>
>
> On 5/19/22 22:09, Vivek Goyal wrote:
> > On Thu, May 19, 2022 at 04:43:58PM +0200, Miklos Szeredi wrote:
> > > Hi Al,
> > >
> > > Do you see anything bad with allowing ->atomic_open() to take a positive dentry
> > > and possibly invalidate it after it does the atomic LOOKUP/CREATE+OPEN?
> > >
> > > It looks wrong not to allow optimizing away the roundtrip associated with
> > > revalidation when we do allow optimizing away the roundtrip for the initial
> > > lookup in the same situation.
> > >
> > > Thanks,
> > > Miklos
> > >
> > >
> > > diff --git a/fs/namei.c b/fs/namei.c
> > > index 509657fdf4f5..d35b5cbf7f64 100644
> > > --- a/fs/namei.c
> > > +++ b/fs/namei.c
> > > @@ -3267,7 +3267,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
> > > dput(dentry);
> > > dentry = NULL;
> > > }
> > > - if (dentry->d_inode) {
> > > + if (dentry->d_inode && !d_atomic_open(dentry)) {
> > > /* Cached positive dentry: will open in f_op->open */
> > > return dentry;
> >
> > Hi Miklos,
> >
> > I see that lookup_open() calls d_revalidate() first. So basically
> > idea is that fuse ->.d_revalidate will skip LOOKUP needed to make sure
> > dentry is still valid (Only if atomic lookup+open is implemented) and
> > return 1 claiming dentry is valid.
> >
> > And later in ->atomic_open(), it will either open the file or
> > get an error and invalidate dentry. Hence will save one LOOKUP in
> > success case. Do I understand the intent right?
>
> Yeah, I think Dharmendra and I had internally already debated over this. In
> order to reduce complexity for the patches we preferred to go without vfs
> modifications.
Fair enough. It is not trivial to be able to see all the paths and make
sure none of these paths is broken.
>
> I assume the patch is a follow up to this comment
> https://lore.kernel.org/all/20220517100744.26849-1-dharamhans87@gmail.com/T/#m8bd440ddea4c135688c829f34e93371e861ba9fa
>
Yes looks like. There are too many paths here and being able to wrap
one's head around all the paths is not trivial. Thankfully miklos
has summarized it here.
https://lore.kernel.org/all/20220517100744.26849-1-dharamhans87@gmail.com/T/#m90f64cd8c8fff70e2fba2b551ae01d0d47b3337e
Thanks
Vivek
next prev parent reply other threads:[~2022-05-19 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 14:43 [RFC PATCH] vfs: allow ->atomic_open() on positive Miklos Szeredi
2022-05-19 20:09 ` Vivek Goyal
2022-05-19 20:43 ` Bernd Schubert
2022-05-19 20:50 ` Vivek Goyal [this message]
2022-05-20 6:48 ` Miklos Szeredi
2022-05-20 4:07 ` Al Viro
2022-05-20 6:44 ` Miklos Szeredi
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=YoatrAK9sWiTZ/1z@redhat.com \
--to=vgoyal@redhat.com \
--cc=bschubert@ddn.com \
--cc=dharamhans87@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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).