Skip to content

Commit f772800

Browse files
halil-pasicmstsirkin
authored andcommitted
virtio_ring: fix return code on DMA mapping fails
Commit 780bc79 ("virtio_ring: Support DMA APIs") makes virtqueue_add() return -EIO when we fail to map our I/O buffers. This is a very realistic scenario for guests with encrypted memory, as swiotlb may run out of space, depending on it's size and the I/O load. The virtio-blk driver interprets -EIO form virtqueue_add() as an IO error, despite the fact that swiotlb full is in absence of bugs a recoverable condition. Let us change the return code to -ENOMEM, and make the block layer recover form these failures when virtio-blk encounters the condition described above. Cc: [email protected] Fixes: 780bc79 ("virtio_ring: Support DMA APIs") Signed-off-by: Halil Pasic <[email protected]> Tested-by: Michael Mueller <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent af42d34 commit f772800

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/virtio/virtio_ring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
583583
kfree(desc);
584584

585585
END_USE(vq);
586-
return -EIO;
586+
return -ENOMEM;
587587
}
588588

589589
static bool virtqueue_kick_prepare_split(struct virtqueue *_vq)
@@ -1085,7 +1085,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
10851085
kfree(desc);
10861086

10871087
END_USE(vq);
1088-
return -EIO;
1088+
return -ENOMEM;
10891089
}
10901090

10911091
static inline int virtqueue_add_packed(struct virtqueue *_vq,

0 commit comments

Comments
 (0)