Re: [PATCH v2 16/21] fuse: allow backing_id=0 in open to inherit inode's backing file

Amir Goldstein <[email protected]> Sat, 16 May 2026 23:07:12 +0200
Newsgroups org.kernel.vger.linux-unionfs,dev.linux.lists.fuse-devel
Message-ID <CAOQ4uxjZNfhY_NfS4B3EorqLdKRhzmTXEgKyPZJYwY_FaQdM5Q@mail.gmail.com>
On Sat, May 16, 2026 at 2:52 AM Joanne Koong <[email protected]> wrote:
>
> With FUSE_PASSTHROUGH_INO, the backing file is associated with the inode
> at lookup time. Allow the server to pass in backing_id=0 in the open
> response. On the kernel side, this uses the backing file already set up
> on the inode.
>
> Signed-off-by: Joanne Koong <[email protected]>

Reviewed-by: Amir Goldstein <[email protected]>

> ---
>  fs/fuse/passthrough.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
> index d62a1c751157..ae0137caa06d 100644
> --- a/fs/fuse/passthrough.c
> +++ b/fs/fuse/passthrough.c
> @@ -193,13 +193,17 @@ int fuse_passthrough_readdir(struct file *file, struct dir_context *ctx)
>   */
>  struct fuse_backing *fuse_passthrough_open(struct file *file, int backing_id)
>  {
> +       struct fuse_inode *fi = get_fuse_inode(file_inode(file));
>         struct fuse_file *ff = file->private_data;
>         struct fuse_conn *fc = ff->fm->fc;
>         struct fuse_backing *fb = NULL;
>         struct file *backing_file;
>         int err;
>
> -       fb = fuse_backing_id_get(fc, backing_id);
> +       if (!backing_id && fc->passthrough_ino)
> +               fb = fuse_backing_get(fuse_inode_backing(fi));
> +       else
> +               fb = fuse_backing_id_get(fc, backing_id);
>         if (IS_ERR_OR_NULL(fb)) {
>                 err = fb ? PTR_ERR(fb) : -ENOENT;
>                 fb = NULL;
> --
> 2.52.0
>