Commit 3586f43
fuse: virtio_fs: clamp max_pages_limit by the transport DMA mapping size
virtio-fs negotiates max_pages (and therefore max_write) without regard
for the maximum size of a single DMA mapping the transport can perform.
When the device sits behind a bouncing DMA layer -- e.g. swiotlb=force,
which WSL enables whenever a virtio-fs device is present -- the effective
per-mapping limit is IO_TLB_SEGSIZE * IO_TLB_SIZE = 256 KiB. Combined
with the FUSE default of 256 pages (1 MiB max_write), the guest builds
read/readdir/write requests whose buffers cannot be DMA-mapped, which
fails with -EIO and wedges the request virtqueue.
virtio-blk already avoids this class of bug by clamping its transfer
size with virtio_max_dma_size(). Do the same here: lower the
connection's max_pages_limit to the transport's per-mapping DMA limit,
right next to the existing virtqueue-size clamp. process_init_reply()
then caps the negotiated max_pages (and transitively max_write) to a
value the guest can always map. When no DMA limit applies,
virtio_max_dma_size() returns SIZE_MAX and the clamp is a no-op.
Signed-off-by: Ben Hillis <benhill@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7d0a66e commit 3586f43
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1703 | 1703 | | |
1704 | 1704 | | |
1705 | 1705 | | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1706 | 1715 | | |
1707 | 1716 | | |
1708 | 1717 | | |
| |||
0 commit comments