Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions fs/fuse/virtio_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,15 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
virtqueue_size - FUSE_HEADER_OVERHEAD);

/*
* Also bound requests by the transport's maximum single DMA mapping
* size (e.g. swiotlb's 256 KiB cap) so the guest never builds a
* request whose buffer cannot be DMA-mapped.
*/
fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
virtio_max_dma_size(fs->vqs[VQ_REQUEST].vq->vdev)
>> PAGE_SHIFT);

fsc->s_fs_info = fm;
sb = sget_fc(fsc, virtio_fs_test_super, set_anon_super_fc);
if (fsc->s_fs_info)
Expand Down