]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
nvme: call blk_drain in NVMe reset code to avoid lockups
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Tue, 6 Nov 2018 12:16:55 +0000 (12:16 +0000)
committerKevin Wolf <kwolf@redhat.com>
Thu, 22 Nov 2018 15:43:52 +0000 (16:43 +0100)
When blk_flush called in NVMe reset path S/C queues are already freed
which means that re-entering AIO handling loop having some IO requests
unfinished will lockup or crash as their SG structures being potentially
reused. Call blk_drain before freeing the queues to avoid this nasty
scenario.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/block/nvme.c

index d0226e7fdcd029e8b758668393e79f394da054db..28d284346dd005859a40a554ffb223c483a36a81 100644 (file)
@@ -797,6 +797,8 @@ static void nvme_clear_ctrl(NvmeCtrl *n)
 {
     int i;
 
+    blk_drain(n->conf.blk);
+
     for (i = 0; i < n->num_queues; i++) {
         if (n->sq[i] != NULL) {
             nvme_free_sq(n->sq[i], n);