]> git.proxmox.com Git - mirror_qemu.git/commit
hw/nvme: fix aio cancel in format
authorKlaus Jensen <k.jensen@samsung.com>
Thu, 10 Nov 2022 06:59:40 +0000 (07:59 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Thu, 1 Dec 2022 07:44:16 +0000 (08:44 +0100)
commit433c71e494ec66a7455b8ef2e6b2b42118426e50
treee64647d336ce7cbad6c3b33d09d4bce2ea8bb56e
parentc4ffd91aba1c3d878e99a3e7ba8aad4826728ece
hw/nvme: fix aio cancel in format

There are several bugs in the async cancel code for the Format command.

Firstly, cancelling a format operation neglects to set iocb->ret as well
as clearing the iocb->aiocb after cancelling the underlying aiocb which
causes the aio callback to ignore the cancellation. Trivial fix.

Secondly, and worse, because the request is queued up for posting to the
CQ in a bottom half, if the cancellation is due to the submission queue
being deleted (which calls blk_aio_cancel), the req structure is
deallocated in nvme_del_sq prior to the bottom half being schedulued.

Fix this by simply removing the bottom half, there is no reason to defer
it anyway.

Fixes: 3bcf26d3d619 ("hw/nvme: reimplement format nvm to allow cancellation")
Reported-by: Jonathan Derrick <jonathan.derrick@linux.dev>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/nvme/ctrl.c