Hi Miklos, On 26/11/2026 22:47, Miklos Szeredi wrote: > If FUSE_REMOVEMAPPING fails, at least one range is still mapped on the > server side. Both callers return the ranges to the free pool regardless, > so the next allocation can hand one to a different inode while the server > still has it mapped, exposing one file's data in another. > > The ranges cannot be reused, but they also cannot usefully be tracked. > The requests are sent in batches and the first failure aborts the rest, so > it is not known which of them the server did drop; and a server that > refuses a request it is required to honour will keep refusing, so every > range ends up retired one by one, with nothing to replenish the pool. > __fuse_dax_fault() then waits uninterruptibly in wait_event() for a free > range that can never arrive. Quietly retiring ranges only delays the > failure and makes it worse when it comes. >
As far as I understand it—please correct me if I'm wrong: reclaim_one_dmap_locked() first calls dmap_writeback_invalidate() to write back and invalidate the pages in the file range corresponding to the DAX window on the old inode, tearing down any userspace page table entries pointing to this DAX window. Then interval_tree_remove() ensures the old inode can no longer look up this window. Both steps happen before dmap_removemapping_one(). The same applies to inode eviction: fuse_evict_inode() calls dax_break_layout_final() and fuse_vdax_inode_cleanup() before sending FUSE_REMOVEMAPPING. Therefore, even if FUSE_REMOVEMAPPING is skipped or fails and a subsequent FUSE_SETUPMAPPING is issued for the same DAX window, the guest page tables of the old inode no longer point to it. When mapping that same DAX window to another inode via FUSE_SETUPMAPPING, the legacy implementation (the C version of virtiofsd and the out-of-tree DAX patches in QEMU) directly mmaps the new inode over the same virtual address range backing the DAX window, and guest virtiofs only inserts the DAX window into the new inode's interval tree after FUSE_SETUPMAPPING succeeds. Thus, stale data from the old file will not leak into the new file. As for the latest Rust virtiofsd implementation, it simply returns -ENOSYS for any FUSE_SETUPMAPPING / FUSE_REMOVEMAPPING requests from guest virtiofs. Given this, I feel FUSE_REMOVEMAPPING can just be best-effort, without needing to abort the connection. Thanks, Li Wang
