hw/nvme: drop AER requests without aiocb in nvme_del_sq()
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. Cc: qemu-stable@nongnu.org Signed-off-by: Minwoo Im <minwoo.im@samsung.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Minwoo Im committed
Jul 29, 2026 at 19:34 UTC
1d5e53df1674e0e45be50a4a873e6deede2eecd7
1 file changed
+6
-4
hw/nvme/ctrl.c
+6
-4
@@ -4862,12 +4862,14 @@ static uint16_t nvme_del_sq(NvmeCtrl *n, NvmeRequest *req)
4862
sq = n->sq[qid];
4863
while (!QTAILQ_EMPTY(&sq->out_req_list)) {
4864
r = QTAILQ_FIRST(&sq->out_req_list);
4865
- assert(r->aiocb);
4865
r->status = NVME_CMD_ABORT_SQ_DEL;
4867
- blk_aio_cancel(r->aiocb);
4868
- }
4866
4870
- assert(QTAILQ_EMPTY(&sq->out_req_list));
4867
+ if (r->aiocb) {
4868
+ blk_aio_cancel(r->aiocb);
4869
+ } else {
4870
+ QTAILQ_REMOVE(&sq->out_req_list, r, entry);
4871
+ }
4872
+ }
4873
4874
if (!nvme_check_cqid(n, sq->cqid)) {
4875
cq = n->cq[sq->cqid];