Re: [PATCH 1/2] fs: move getname and putname handlers into namei.h

From: Al Viro
Date: Mon Dec 01 2025 - 02:54:43 EST


On Mon, Dec 01, 2025 at 07:27:05AM +0100, Mateusz Guzik wrote:
> self-NAK, i'm going to rebase on top of
> https://lore.kernel.org/linux-fsdevel/20251129170142.150639-1-viro@xxxxxxxxxxxxxxxxxx/
> when the time comes

FWIW, I'm putting together struct filename-related
branches for the next cycle (trying to figure out what's the
best way to linearize the mess I've got).

If you throw a patch on top of the series I've posted
on Friday (and it should shrink a whole lot - the damn thing
is static in fs/namei.c now, with cache initialization done
in the same place) I would be glad to apply it.

Other series around struct filename for the next
cycle:

* DEFINE_CLASS(filename, struct filename *, putname(_T), getname(p), const char __user *p)
EXTEND_CLASS(filename, _kernel, getname_kernel(p), const char *p)
EXTEND_CLASS(filename, _flags, getname_flags(p, f), const char *p, unsigned int f)
EXTEND_CLASS(filename, _uflags, getname_uflags(p, f), const char *p, unsigned int f)
EXTEND_CLASS(filename, _maybe_null, getname_maybe_null(p, f), const char *p, unsigned int f)
EXTEND_CLASS(filename, _consume, no_free_ptr(p), struct filename *p)
and an bunch of conversions making use of that. Generally I dislike RAII
patterns, but uses of struct filename make a reasonably good fit.

* change of calling conventions for do_filp_open() - let it DTRT when
it's given ERR_PTR() for name. Surprising amount of error handling
in the callers (and callers of callers, etc.) folds into that.
One thing that is very tempting is s/do_filp_open/do_file_open/,
while we are at it...

* killing pointless checks for IS_ERR() before calling filename_lookup()
and vfs_path_parent_lookup() - those already treat ERR_PTR() for name
as "bail out immediately".

* [currently very tentative] dealing with __audit_inode(). It's
a surprisingly convoluted series, and it's not quite finished yet.
Not sure if that one won't end up slipping past 6.20...

Linearizing that stuff into something that would not be a hell wrt
merges is... interesting.