From: Amir Goldstein <amir73il@gmail.com>
To: Matan Cohen <matan@matanco.space>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-fsdevel@vger.kernel.org, fuse-devel@lists.linux.dev
Subject: Re: [PATCH] fuse: expose backing files in the daemon's fd table
Date: Mon, 27 Apr 2026 21:24:26 +0200 [thread overview]
Message-ID: <ae-36oamXRxbGbbj@amir-ThinkPad-T480> (raw)
In-Reply-To: <20260424144553.6241-1-matan@matanco.space>
[removing irrelevant lists]
Hi Matan!
On Fri, Apr 24, 2026 at 02:45:53PM +0000, Matan Cohen wrote:
> FUSE passthrough backing files are currently not installed in the
> daemon's fd table, making them invisible to lsof(8) and /proc/<pid>/fd.
> This complicates debugging and is the reason passthrough currently
> requires CAP_SYS_ADMIN.
>
> Install each backing file into the daemon's fd table on BACKING_OPEN
> and close it on BACKING_CLOSE. Add an fd field to struct fuse_backing
> to carry the installed fd number.
>
> BACKING_CLOSE always runs in the daemon's ioctl context, so close_fd()
> targets the correct fd table directly.
>
> To handle fds that remain open at connection teardown (e.g. on umount
> or connection abort without an explicit BACKING_CLOSE), store a
> reference to the daemon's task_struct in fc->daemon_task on the first
> BACKING_OPEN. During teardown, fuse_backing_files_free() schedules a
> task_work callback on the daemon task that calls close_fd() from the
> daemon's own context. If the daemon has already exited (task_work_add
> returns -ESRCH), its fd table was already cleaned up on exit.
>
I am sorry but both the approach and the implementation are wrong for
several different reasons, so I will not start to list them.
Please follow this discussion:
https://lore.kernel.org/linux-fsdevel/CAJfpegvaCTxS_wC6EGFfh3Gim5DEgOtuju=_=qCsouzkCRvJog@mail.gmail.com/
It does not end with a definite decision on the best way to export
backing files to lsof, but it does pave the general direction the
the solution should take.
> This is a prerequisite for relaxing the CAP_SYS_ADMIN requirement on
> FUSE passthrough; a follow-up patch will drop the capability check now
> that backing fds are accountable via /proc/<pid>/fd.
This is one prerequisite, not all of them.
See "Resource Accounting and Visibility" section in
Documentation/filesystems/fuse/fuse-passthrough.rst
Please CC me and the new fuse-devel list on future attempts to address
this issue. There is no need to CC LKML and selftest maintainers.
Thanks,
Amir.
next prev parent reply other threads:[~2026-04-27 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 14:45 [PATCH] fuse: expose backing files in the daemon's fd table Matan Cohen
2026-04-27 19:24 ` Amir Goldstein [this message]
2026-04-28 8:17 ` kernel test robot
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=ae-36oamXRxbGbbj@amir-ThinkPad-T480 \
--to=amir73il@gmail.com \
--cc=fuse-devel@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matan@matanco.space \
--cc=miklos@szeredi.hu \
/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