mirror of https://github.com/xemu-project/xemu.git
Pull request
Phil's block/nvme.c ENOSPC fix for newer Linux kernels that return this errno. -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmD+d+0ACgkQnKSrs4Gr c8j+YwgAuo2jX4ugUo4DDORe2EYNYBAGAklhW/mSkwuibT2qfgUAwrXSE3gDjSXA RKxIusQFTiK2sov/bscr2u5pHz4HCA441qTlTOnnv6CVJNFRG5RTRnZMD+pMDSY1 WNkG1t8hN5cUxXSzd+F7cCe9pVl0kzAuSPp7vKSZ7tTaQPAW/eD0W1/8Xaulysst o/64VqyEKxz3bWdr0FBfyMtEwwwVo7YGS9y6Ea4z6jJj6/r9fKA9qH2jUNcVM0rc 2PDcb4Lfr6IO9w6dZOmcDV58u8L8ihrBlB2JAy8IK6Ow+vkBW6mYkapFHqqBHqPS wt2veksFYhjzCpHzG6IfEkRpZ0J1aA== =YOYQ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging Pull request Phil's block/nvme.c ENOSPC fix for newer Linux kernels that return this errno. # gpg: Signature made Mon 26 Jul 2021 09:53:01 BST # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha-gitlab/tags/block-pull-request: block/nvme: Fix VFIO_MAP_DMA failed: No space left on device Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
76bf66b913
22
block/nvme.c
22
block/nvme.c
|
@ -1030,7 +1030,29 @@ try_map:
|
|||
r = qemu_vfio_dma_map(s->vfio,
|
||||
qiov->iov[i].iov_base,
|
||||
len, true, &iova);
|
||||
if (r == -ENOSPC) {
|
||||
/*
|
||||
* In addition to the -ENOMEM error, the VFIO_IOMMU_MAP_DMA
|
||||
* ioctl returns -ENOSPC to signal the user exhausted the DMA
|
||||
* mappings available for a container since Linux kernel commit
|
||||
* 492855939bdb ("vfio/type1: Limit DMA mappings per container",
|
||||
* April 2019, see CVE-2019-3882).
|
||||
*
|
||||
* This block driver already handles this error path by checking
|
||||
* for the -ENOMEM error, so we directly replace -ENOSPC by
|
||||
* -ENOMEM. Beside, -ENOSPC has a specific meaning for blockdev
|
||||
* coroutines: it triggers BLOCKDEV_ON_ERROR_ENOSPC and
|
||||
* BLOCK_ERROR_ACTION_STOP which stops the VM, asking the operator
|
||||
* to add more storage to the blockdev. Not something we can do
|
||||
* easily with an IOMMU :)
|
||||
*/
|
||||
r = -ENOMEM;
|
||||
}
|
||||
if (r == -ENOMEM && retry) {
|
||||
/*
|
||||
* We exhausted the DMA mappings available for our container:
|
||||
* recycle the volatile IOVA mappings.
|
||||
*/
|
||||
retry = false;
|
||||
trace_nvme_dma_flush_queue_wait(s);
|
||||
if (s->dma_map_count) {
|
||||
|
|
Loading…
Reference in New Issue