Re: [RFC][PATCH 11/13] allow incomplete imports of filenames

Al Viro
2025-11-19T05:41:33Z

On Wed, Nov 19, 2025 at 01:14:47AM +0000, Al Viro wrote:
> On Wed, Nov 19, 2025 at 01:12:23AM +0000, Al Viro wrote:
>
> > int putname_to_incomplete(struct incomplete_name *v, struct filename *name)
> > {
> > if (likely(name->refcnt == 1)) {
> > v->__incomplete_filename = name;
> > return 0;
> > }
> > v->__incomplete_filename = <duplicate name>;
> > putname(name);
> > if (unlikely(!v->__incomplete_filename))
> > return -ENOMEM;
> > return 0;
> > }
> >
> > and have
> > if (ret == -EAGAIN &&
> > (!resolve_nonblock && (issue_flags & IO_URING_F_NONBLOCK))) {
> > ret = putname_to_incomplete(&open->filename,
> > no_free_ptr(name));
> > if (unlikely(ret))
> > goto err;
> > return -EAGAIN;
> > }
> >
> > in io_openat2() (in addition to what's already done in 11/13). Workable or
> > too disgusting?
>
> Note that copying would happen only if extra references had been grabbed
> and are still held; that's already a slow path.

... and writing the "duplicate name" part has been a very convincing argument
in favour of a scheme Linus suggested upthread (shorter embedded name,
struct filename *always* coming from names_cachep, long name or short).
Current layout is too unpleasant to work with.