Re: [PATCH v2 0/5] pid: add pidfd_open()

From: Christian Brauner
Date: Sun Mar 31 2019 - 20:22:24 EST


On Sun, Mar 31, 2019 at 05:18:10PM -0700, Linus Torvalds wrote:
> On Sun, Mar 31, 2019 at 5:09 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Ugh... Which vfsmount would you have to go with it?
>
> I'd literally just do a lookup of "/proc" in the current root
> directory in the lookup() function for that special pseudo-dentry.
>
> If it's not mounted, or not a /proc filesystem, screw it.
>
> > Except that we never let unattached _directory_ dentries out - if
> > we can't reattach them to the tree, open-by-handle will tell you to
> > take a hike.
>
> Absolutely. Which is why I said it's _conceptually_ similar to the alias lookup.
>
> And I suspect we can even use some of the same practical logic, but
> it's definitely not _exactly_ the same. This thing very much involves
> magic hooking into the lookup() function (but we then have to look up
> the alias not for the path we're looking up, but for the _parent_
> we're looking that path up in, which is very different from the normal
> case).
>
> > It's more than a tiny bit too clever for mine...
>
> Fair enough. The whole "just do the whole lookup at pidfd creation
> time" is certainly a whole lot simpler.

Even just from a pure maintenance perspective this sounds a better to me.