Re: [PATCH] vfs: relax linkat() AT_EMPTY_PATH - aka flink() - requirements

From: Linus Torvalds
Date: Thu Apr 11 2024 - 13:55:56 EST


On Thu, 11 Apr 2024 at 05:25, Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> Btw, I think we should try to avoid putting this into path_init() and
> confine this to linkat() itself imho. The way I tried to do it was by
> presetting a root for filename_lookup(); means we also don't need a
> LOOKUP_* flag for this as this is mostly a linkat thing.

So I had the exact reverse reaction to your patch - I felt that using
that 'root' thing was the hacky case.

The lookup flag may be limited to linkat(), but it makes the code
smaller and clearer, and avoids having multiple places where we check
dfd.

And that 'root' argument really is the special hacky case, and is not
actually used by any normal system call path, and is meant for
internal kernel use rather than any generic case.

Linus