Re: [PATCH 1/3] hw/nvme: drop AER requests without aiocb in nvme_del_sq()

Klaus Jensen <[email protected]>
Newsgroups gmane.comp.emulators.qemu,gmane.comp.emulators.qemu.block
Message-ID <[email protected]>
On Jul 29 19:34, Minwoo Im wrote:
> nvme_del_sq() asserted r->aiocb was always set when canceling a
> queue's inflight requests. A pending Async Event Request has no
> aiocb (nvme_aer() parks it without issuing any block I/O), so
> deleting a queue with an outstanding AER trips the assert instead of
> just dropping the request.
> 
> Signed-off-by: Minwoo Im <[email protected]>
> ---
>  hw/nvme/ctrl.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index a67e1598891c..e715de8247d1 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -4858,12 +4858,14 @@ static uint16_t nvme_del_sq(NvmeCtrl *n, NvmeRequest *req)
>      sq = n->sq[qid];
>      while (!QTAILQ_EMPTY(&sq->out_req_list)) {
>          r = QTAILQ_FIRST(&sq->out_req_list);
> -        assert(r->aiocb);
>          r->status = NVME_CMD_ABORT_SQ_DEL;
> -        blk_aio_cancel(r->aiocb);
> -    }
>  
> -    assert(QTAILQ_EMPTY(&sq->out_req_list));
> +        if (r->aiocb) {
> +            blk_aio_cancel(r->aiocb);
> +        } else {
> +            QTAILQ_REMOVE(&sq->out_req_list, r, entry);
> +        }
> +    }
>  
>      if (!nvme_check_cqid(n, sq->cqid)) {
>          cq = n->cq[sq->cqid];
> -- 
> 2.34.1
> 
> 

Thanks,

Reviewed-by: Klaus Jensen <[email protected]>
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmpsa5IACgkQTeGvMW1P
DelymQf/evsuqw+aH4yYNdECcTZmWwHtqcr8fp4QHqenGjBGOGLgdsGWqbR5vRsW
dXb2sQmJBTW5wWEXalrCGuiMB6tVejIglYXJNmCunfREhFMT80zeecwI8rcAHsny
ImRjdRbUO0ssAKPger6uRmbm2ET12E8Roo2k/lF509y6je5yR/N/t+Qy/qOfnB1b
IQ80AzyhknU3dEwGB0v8PrJySa/FLka0aMvIxHl9F+AVHUackPpaIQvbucJ0wBw4
3S9mi5QByMeqg0gaKM3FU6cjbotI0JM0e/EsURP138aQOh9PhZqvfc+A9n3rkBXf
Wwadtg+S/zK9IorNBmQKN2fndfcHZA==
=l7Vl
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.