[PATCH v2 08/21] fuse: handle zero ops_mask in FUSE_DEV_IOC_BACKING_OPEN
Joanne Koong <[email protected]> Fri, 15 May 2026 17:39:51 -0700
| Newsgroups | org.kernel.vger.linux-unionfs,dev.linux.lists.fuse-devel |
|---|---|
| Message-ID | <[email protected]> |
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]> --- 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