Re: [PATCH v3 2/3] fs: fuse: add backing_files control file

From: Chen Linxuan
Date: Fri May 09 2025 - 10:44:44 EST


On Fri, May 9, 2025 at 10:00 PM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> On Fri, 9 May 2025 at 08:34, Chen Linxuan via B4 Relay
> <devnull+chenlinxuan.uniontech.com@xxxxxxxxxx> wrote:
> >
> > From: Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx>
> >
> > Add a new FUSE control file "/sys/fs/fuse/connections/*/backing_files"
> > that exposes the paths of all backing files currently being used in
> > FUSE mount points. This is particularly valuable for tracking and
> > debugging files used in FUSE passthrough mode.
>
> This is good work, thanks.
>
> My concern is that this is a very fuse specific interface, even though
> the problem is more generic: list hidden open files belonging to a
> kernel object, but not installed in any fd:
>
> - SCM_RIGHTS
> - io_uring

Note that io_uring has already exposed information about fixed files
in its fdinfo.

> - fuse
>
> So we could have a new syscall or set of syscalls for this purpose.
> But that again goes against my "this is not generic enough" pet peeve.
>
> So we had this idea of reusing getxattr and listxattr (or implementing
> a new set of syscalls with the same signature) to allow retrieving a
> hierarchical set of attributes belonging to a kernel object. This one
> would also fit that pattern, so...
>
> Thoughts?

Using getxattr does make it more generalized, and I think reusing it
is a good choice.
However, I have some questions:
If we use getxattr,

For io_uring, the path could be the corresponding /proc/PID/fd/* of io_uring.
For FUSE, the path could be /sys/fs/fuse/connections/*.
But for SCM_RIGHTS, what would the corresponding path be? Could it be
the fd under procfs of unix domain socket?

I am also uncertain whether there might be similar situations in the future.
Would we really be able to find a suitable path for all of them?

Thanks,
Chen Linxuan

>
> Thanks,
> Miklos
>
>