diff options
author | Igor Druzhinin <igor.druzhinin@citrix.com> | 2018-11-06 12:16:55 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-11-22 16:43:52 +0100 |
commit | 6bf7463615752934d7221e5be9820d9da45ab2de (patch) | |
tree | b873ae115df8c9178f9c0c7c6d4befc1ff90423f /hw/block/nvme.c | |
parent | e4c8f2925d22584b2008aadea5c70e1e05c2a522 (diff) | |
download | qemu-6bf7463615752934d7221e5be9820d9da45ab2de.zip |
nvme: call blk_drain in NVMe reset code to avoid lockups
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>
Diffstat (limited to 'hw/block/nvme.c')
-rw-r--r-- | hw/block/nvme.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index d0226e7fdc..28d284346d 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -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); |