Re: [PATCH v2 08/21] fuse: handle zero ops_mask in FUSE_DEV_IOC_BACKING_OPEN

Amir Goldstein <[email protected]> Sat, 16 May 2026 17:35:30 +0200
Newsgroups org.kernel.vger.linux-unionfs,dev.linux.lists.fuse-devel
Message-ID <CAOQ4uxhUvy_+AEF10H7C1mH8ue9uDQuvcaPJqsMGssWawJZc4Q@mail.gmail.com>
On Sat, May 16, 2026 at 2:52 AM Joanne Koong <[email protected]> wrote:
>
> Servers that pre-date the ops_mask field will pass a zero ops_mask in
> FUSE_DEV_IOC_BACKING_OPEN. Default this to FUSE_PASSTHROUGH_RW_OPS to
> maintain backwards compatibility.
>
> For FUSE_PASSTHROUGH_INO servers, an ops_mask must be set.
> FUSE_PASSTHROUGH_INO is a new feature with no backwards compatibliity
> requirements.
>
> Signed-off-by: Joanne Koong <[email protected]>

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

> ---
>  fs/fuse/backing.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c
> index 2234ab47406a..b499860e1185 100644
> --- a/fs/fuse/backing.c
> +++ b/fs/fuse/backing.c
> @@ -119,9 +119,23 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
>         if (map->flags || map->ops_mask & ~FUSE_BACKING_MAP_VALID_OPS)
>                 goto out;
>
> -       /* For now passthrough inode operations requires FUSE_PASSTHROUGH_INO */
> -       if (!fc->passthrough_ino && map->ops_mask & FUSE_PASSTHROUGH_INODE_OPS)
> -               goto out;
> +       if (!fc->passthrough_ino) {
> +               /*
> +                * For now passthrough inode operations requires
> +                * FUSE_PASSTHROUGH_INO
> +                */
> +               if (map->ops_mask & FUSE_PASSTHROUGH_INODE_OPS)
> +                       goto out;
> +               /*
> +                * To maintain backwards compatibility with servers that
> +                * pre-date the ops_mask field, a zero ops_mask defaults
> +                * to passing through both reads and writes
> +                */
> +               if (!map->ops_mask)
> +                       map->ops_mask |= FUSE_PASSTHROUGH_RW_OPS;
> +       } else if (!map->ops_mask) {
> +               return -EINVAL;
> +       }
>
>         file = fget_raw(map->fd);
>         res = -EBADF;
> --
> 2.52.0
>
>