qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/nvme: call blk_drain in NVMe reset code to avoid lockups
@ 2018-11-06 12:16 Igor Druzhinin
  2018-11-14 17:42 ` Igor Druzhinin
  2018-11-22 14:32 ` Kevin Wolf
  0 siblings, 2 replies; 5+ messages in thread
From: Igor Druzhinin @ 2018-11-06 12:16 UTC (permalink / raw)
  To: keith.busch, kwolf, mreitz; +Cc: qemu-devel, qemu-block, Igor Druzhinin

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>
---
 hw/block/nvme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index fc7dacb..cdf836e 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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-22 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06 12:16 [Qemu-devel] [PATCH] block/nvme: call blk_drain in NVMe reset code to avoid lockups Igor Druzhinin
2018-11-14 17:42 ` Igor Druzhinin
2018-11-20 17:31   ` Igor Druzhinin
2018-11-20 17:52     ` Paolo Bonzini
2018-11-22 14:32 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).