From 6704a78171aa20caab2cd16da9ae2ff8edd4bb1d Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 10 Nov 2026 11:26:55 +0100 Subject: fuse: advertise support for DAX mappings Reuse the FUSE_HAS_INODE_DAX flag, which previously was only used for the virtiofs case. The two uses are unrelated: for virtiofs the flag means that host memory can be mapped directly into the guest, while here it means that the server may back an inode with a dax device opened via FUSE_DEV_IOC_BACKING_OPEN. Gate the advertisement on IS_REACHABLE(CONFIG_DEV_DAX_FSDEV), which is what fuse_backing_open_file() requires before it accepts a dax device as backing; CONFIG_FS_DAX alone is not sufficient. Plain fuse servers should check both FUSE_HAS_INODE_DAX and FUSE_PASSTHROUGH_V2 before enabling passthrough dax support. Stop advertising FUSE_PASSTHROUGH(_V2) in the virtiofs case, which doesn't support passthrough mode. Note: FUSE_HAS_INODE_DAX flag in the INIT reply is ignored, so it's handled slightly differently from the virtiofs case. This is deliberate. The server needs to check both FUSE_PASSTHROUGH_V2 and FUSE_HAS_INODE_DAX before enabling DAX based extent map if it wants to bail or fall back to plain I/O mode on kernels not supporting this feature. A broken server that does not check the features yet sets FUSE_ATTR_DAX will result in an error on open. This is not backward compatible, since this flag was silently ignored previously, but unlikely to be an issue in real life. Fixes: 2fbe4586cff3 ("fuse: add support for opening dax device as backing") Signed-off-by: Miklos Szeredi --- include/uapi/linux/fuse.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 616430a2973c..cb9e9554f0ef 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -257,6 +257,7 @@ * - add backing_id_64 to fuse_open_out * - add FUSE_NOTIFY_BACKING_MAP, fuse_notify_backing_map_out, fuse_extent * - add FUSE_BACKING_MAP_CREATE, FUSE_BACKING_MAP_CYCLIC + * - extend the meaning of FUSE_HAS_INODE_DAX and FUSE_ATTR_DAX */ #ifndef _LINUX_FUSE_H @@ -460,7 +461,11 @@ struct fuse_file_lock { * FUSE_INIT_RESERVED: reserved, do not use * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and * mknod - * FUSE_HAS_INODE_DAX: use per inode DAX + * FUSE_HAS_INODE_DAX: use per inode DAX. The meaning depends on the + * transport: on virtio-fs it indicates per-inode DAX + * support, while on /dev/fuse (where FUSE_PASSTHROUGH_V2 + * is also offered) it indicates support for passthrough + * extent maps on a DAX device. * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir, * symlink and mknod (single group that matches parent) * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation @@ -612,7 +617,8 @@ struct fuse_file_lock { * fuse_attr flags * * FUSE_ATTR_SUBMOUNT: Object is a submount root - * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode + * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode and in + * extent mapping passthrough mode */ #define FUSE_ATTR_SUBMOUNT (1 << 0) #define FUSE_ATTR_DAX (1 << 1) -- cgit v1.2.3