Re: [PATCH] ovl: add ioctls to retrieve layer file descriptors
From: Amir Goldstein <amir73il@gmail.com>
Date: 2026-07-09 14:32:15
Also in:
linux-fsdevel, linux-unionfs
On Wed, Jul 8, 2026 at 9:45 PM Miklos Szeredi [off-list ref] wrote:
On Wed, 8 Jul 2026 at 17:55, Giuseppe Scrivano [off-list ref] wrote:quoted
Miklos Szeredi [off-list ref] writes:quoted
On Wed, 8 Jul 2026 at 16:32, Giuseppe Scrivano [off-list ref] wrote:quoted
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.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?That's the reason I advocate pseudo fs based solutions. Let's see, we had a proposal to use openat(), something. like: openat(base_fd, "mount/options/lowerdir+/0", O_ALT | O_PATH);
Ack for this, but please don't use mount/options/... it's a bit ugly
because most mount options are not opan-able.
Please stick to something logical like "fs/layers/N" corresponding to
ovl_fs::layers, where layer 0 is reserved for upper.
We could also support opening by aliases fs/layers/upper->0 etc,
but no rush IMO.
What I am contemplating is whether we should implement
introspection of the ovl_entry stack for merge dirs in addition or instead
introspection of fs/layers.
IIRC, the root dir stack does NOT hold references to lowerdata dirs,
so support for "fs/layers/N" is still needed.
For directories we could implement "real/0..N" with aliases
real/upper->0 real/origin->1.
For a regular file we could have constant aliases real/upper->0
real/lower->1 real/lowerdata->2 and/or dynamic aliases
real/data->{0,1,2}, real/metadata->{0,1}, real/origin->{0,1}.
Those could be used to implement "revert to origin".
Specifically, I think Daan asked for it during the last LSFMM.
Although I don't think we currently store the original lowerdata
in ovl_entry when lookup is done post data copy up.
Thanks,
Amir.