public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Amir Goldstein <amir73il@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org,
	Miklos Szeredi <miklos@szeredi.hu>
Subject: Re: [RFC][overlayfs] do we still need d_instantiate_anon() and export of d_alloc_anon()?
Date: Sat, 11 Nov 2023 18:50:34 +0000	[thread overview]
Message-ID: <20231111185034.GP1957730@ZenIV> (raw)
In-Reply-To: <CAOQ4uxhQdHsegbwdqy_04eHVG+wkntA2g2qwt9wH8hb=-PtT2A@mail.gmail.com>

On Sat, Nov 11, 2023 at 08:31:11PM +0200, Amir Goldstein wrote:
> > in ovl_lookup(), and in case we have d_splice_alias() return a non-NULL
> > dentry we can simply copy it there.  Sure, somebody might race with
> > us, pick dentry from hash and call ->d_revalidate() before we notice that
> > DCACHE_OP_REVALIDATE could be cleaned.  So what?  That call of ->d_revalidate()
> > will find nothing to do and return 1.  Which is the effect of having
> > DCACHE_OP_REVALIDATE cleared, except for pointless method call.  Anyone
> > who finds that dentry after the flag is cleared will skip the call.
> > IOW, that race is harmless.
> 
> Just a minute.
> Do you know that ovl_obtain_alias() is *only* used to obtain a disconnected
> non-dir overlayfs dentry?

D'oh...

> I think that makes all the analysis regarding race with d_splice_alias()
> moot. Right?

Right you are.

> Do DCACHE_OP_*REVALIDATE even matter for a disconnected
> non-dir dentry?

As long as nothing picks it via d_find_any_alias() and moves it somewhere
manually.  The former might happen, the latter, AFAICS, doesn't - nothing
like d_move() anywhere in sight...

> You are missing that the OVL_E_UPPER_ALIAS flag is a property of
> the overlay dentry, not a property of the inode.
> 
> N lower hardlinks, the first copy up created an upper inode
> all the rest of the N upper aliases to that upper inode are
> created lazily.
> 
> However, for obvious reasons, OVL_E_UPPER_ALIAS is not
> well defined for a disconnected overlay dentry.
> There should not be any code (I hope) that cares about
> OVL_E_UPPER_ALIAS for a disconnected overlay dentry,
> so I *think* ovl_dentry_set_upper_alias() in this code is moot.
> 
> I need to look closer to verify, but please confirm my assumption
> regarding the irrelevance of  DCACHE_OP_*REVALIDATE for a
> disconnected non-dir dentry.

Correct; we only care if it gets reconnected to the main tree.
The fact that it's only for non-directories simplifies life a lot
there.  Sorry, got confused by the work you do with ->d_flags
and hadn't stopped to ask whether it's needed in the first place
in there.

OK, so... are there any reasons why simply calling d_obtain_alias()
wouldn't do the right thing these days?

  reply	other threads:[~2023-11-11 18:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11  8:04 [RFC][overlayfs] do we still need d_instantiate_anon() and export of d_alloc_anon()? Al Viro
2023-11-11 18:31 ` Amir Goldstein
2023-11-11 18:50   ` Al Viro [this message]
2023-11-11 20:05     ` Amir Goldstein
2023-11-12  7:26       ` Amir Goldstein
2023-11-18 20:02         ` Al Viro
2023-11-18 21:17           ` Al Viro
2023-11-19  6:57           ` Amir Goldstein
2023-11-19  7:26             ` Al Viro
2023-11-19  8:19               ` Amir Goldstein
2023-11-20 11:39                 ` Amir Goldstein

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=20231111185034.GP1957730@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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