From: Giuseppe Scrivano <gscrivan@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-api@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>,
linux-erofs mailing list <linux-erofs@lists.ozlabs.org>
Subject: Re: [PATCH] ovl: add ioctls to retrieve layer file descriptors
Date: Wed, 08 Jul 2026 22:18:44 +0200 [thread overview]
Message-ID: <87jyr56xqz.fsf@redhat.com> (raw)
In-Reply-To: <CAOQ4uxgbNhdzKN7tvRmFDpt-8CZWh9pVcMLv25HxJzA0_0WfSg@mail.gmail.com> (Amir Goldstein's message of "Wed, 8 Jul 2026 21:01:53 +0200")
Amir Goldstein <amir73il@gmail.com> writes:
> On Wed, Jul 8, 2026 at 5:55 PM Giuseppe Scrivano <gscrivan@redhat.com> wrote:
>>
>> Miklos Szeredi <miklos@szeredi.hu> writes:
>>
>> > On Wed, 8 Jul 2026 at 16:32, Giuseppe Scrivano <gscrivan@redhat.com> wrote:
>> >
>> >> Amir suggested to add that functionality when I've asked for some
>> >> feedback before sending the patch here. I am fine to drop it if this is
>> >> the consensus although I see its utility from user space.
>
> I was thinking that getting the number of layers or info would be
> a good idea to complement getting a layer fd.
>
> I agree that the same information is probably available via statmount
> by parsing the upperdir/lowerdir/datadir mount options.
>
>> >
>> > How about a completely different interface:
>> >
>> > int get_fd_opt(const char *name, unsigned int index, unsigned int flags);
>> >
>> > Enumerating layers would be as easy as passing an index stating from
>> > zero and stopping when -ERANGE is received.
>> >
>> > It would work for all filesystems that use files as options. No more
>> > fs specific ioctls.
>>
>> Is a new syscall really justified for such a narrow use case?
>>
>
> I feel the same way.
>
> Giuseppe,
>
> Could you add some high level context in this thread on why you need
> this functionality.
> I think it's this composefs-rs work. right?
> https://github.com/giuseppe/composefs-rs/commits/reuse-mounts-and-prevent-gc-overlay/
>
> I must say this seems a bit upside down to me.
>
> If you want to keep a pool of mounted erofs images, you could do that
> in userspace -
> create a service that indexes mounted erofs images by unique mount point paths.
> Then you can introspect the overlayfs mount options referring to those
> mount points.
A first issue is that the mount options won't have this information
anymore, as we use /proc/self/fd/$i paths as lower dirs so we are sure
the fd points exactly to the file we have measured its fs-verity digest
before using it.
I know this can be achieved with a system daemon, but do we really need
one if this information is already known to the kernel?
Combined with listmount/statmount for discovery and fs-verity for
validation, the entire mechanism is stateless from userspace.
More in general we need a way to introspect overlay mounts to know where
they are pointing to since paths can be hidden using /proc/*/fd
symlinks, or files get replaced.
Another similar request:
https://github.com/systemd/systemd/issues/35017#issuecomment-2457333218
> Going through the kernel to get an fd and reuse that fd for a new
> overlayfs mount
> sounds like a strange way of accomplishing this.
>
> If the overlayfs mounter is unprivileged, it would have to go through
> systemd-mountfsd
> to request a mount of erofs trusted image, right?
off-topic but for now we are considering FUSE to deal with mounting
EROFS as it would serve only the metadata anyway in a composefs setup.
Regards,
Giuseppe
> Can't the same service provide the "is_image_mounted" query which provides
> the mount path?
>
> I am not against introspection of overlayfs, but I'd like to understand
> the use cases before finalizing the uapi.
>
> Thanks,
> Amir.
next prev parent reply other threads:[~2026-07-08 20:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 9:58 [PATCH] ovl: add ioctls to retrieve layer file descriptors Giuseppe Scrivano
2026-07-08 10:24 ` Miklos Szeredi
2026-07-08 12:27 ` Giuseppe Scrivano
2026-07-08 13:23 ` Amir Goldstein
2026-07-08 13:44 ` Giuseppe Scrivano
2026-07-08 14:01 ` Miklos Szeredi
2026-07-08 20:45 ` Giuseppe Scrivano
2026-07-08 14:08 ` Miklos Szeredi
2026-07-08 14:31 ` Giuseppe Scrivano
2026-07-08 15:37 ` Miklos Szeredi
2026-07-08 15:55 ` Giuseppe Scrivano
2026-07-08 19:01 ` Amir Goldstein
2026-07-08 20:16 ` Colin Walters
2026-07-08 20:18 ` Giuseppe Scrivano [this message]
2026-07-08 19:45 ` Miklos Szeredi
2026-07-08 20:35 ` Giuseppe Scrivano
2026-07-09 6:11 ` Miklos Szeredi
2026-07-09 14:32 ` Amir Goldstein
2026-07-10 18:23 ` Miklos Szeredi
2026-07-08 10:40 ` 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=87jyr56xqz.fsf@redhat.com \
--to=gscrivan@redhat.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/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