Re: [PATCH v2 07/20] Pass parent directory inode and expected name to ->d_revalidate()

Al Viro
2025-01-17T19:00:42Z

On Fri, Jan 17, 2025 at 01:55:01PM -0500, Jeff Layton wrote:
> > +static inline int d_revalidate(struct inode *dir, const struct qstr *name,
> > + struct dentry *dentry, unsigned int flags)
> > {
> > if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
> > - return dentry->d_op->d_revalidate(dentry, flags);
> > + return dentry->d_op->d_revalidate(dir, name, dentry, flags);
>
> I know I sent a R-b for this, but one question:
>
> Suppose we get back a positive result (dentry is still good), but the
> name and dentry->d_name no longer match. Do we need to do any special
> handling in that case?

Not really - it's the same situation we'd have if it got renamed right
after we'd concluded that everything's fine, after all. We can't spin
there indefinitely, rechecking the name for changes ;-)

In RCU mode ->d_seq mismatch guaranteed to catch that, in non-RCU...
well, there's really nothing we could do - rename could've bloody
well happened just as we'd completed pathname resolution.