lkml.org 
[lkml]   [2021]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6 3/7] kernfs: use VFS negative dentry caching
From
Date
On Sat, 2021-06-12 at 00:07 +0000, Al Viro wrote:
> On Wed, Jun 09, 2021 at 04:50:27PM +0800, Ian Kent wrote:
>
> > +       if (d_really_is_negative(dentry)) {
> > +               struct dentry *d_parent = dget_parent(dentry);
> > +               struct kernfs_node *parent;
>
> What the hell is dget_parent() for?  You don't do anything blocking
> here, so why not simply grab dentry->d_lock - that'll stabilize
> the value of ->d_parent just fine.  Just don't forget to drop the
> lock before returning and that's it...

Thanks Al, I'll change it.

>
> > +               /* If the kernfs parent node has changed discard
> > and
> > +                * proceed to ->lookup.
> > +                */
> > +               parent = kernfs_dentry_node(d_parent);
> > +               if (parent) {
> > +                       if (kernfs_dir_changed(parent, dentry)) {
> > +                               dput(d_parent);
> > +                               return 0;
> > +                       }
> > +               }
> > +               dput(d_parent);
> > +
> > +               /* The kernfs node doesn't exist, leave the dentry
> > +                * negative and return success.
> > +                */
> > +               return 1;
> > +       }


\
 
 \ /
  Last update: 2021-06-12 02:44    [W:0.100 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site