qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Denis Plotnikov <den-plotnikov@yandex-team.ru>,
	Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: [PULL 3/9] vhost-user-blk: add immediate cleanup on shutdown
Date: Thu, 1 Apr 2021 14:02:57 -0400	[thread overview]
Message-ID: <20210401180235.226321-4-mst@redhat.com> (raw)
In-Reply-To: <20210401180235.226321-1-mst@redhat.com>

From: Denis Plotnikov <den-plotnikov@yandex-team.ru>

Qemu crashes on shutdown if the chardev used by vhost-user-blk has been
finalized before the vhost-user-blk.

This happens with char-socket chardev operating in the listening mode (server).
The char-socket chardev emits "close" event at the end of finalizing when
its internal data is destroyed. This calls vhost-user-blk event handler
which in turn tries to manipulate with destroyed chardev by setting an empty
event handler for vhost-user-blk cleanup postponing.

This patch separates the shutdown case from the cleanup postponing removing
the need to set an event handler.

Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
Message-Id: <20210325151217.262793-4-den-plotnikov@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/block/vhost-user-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 4e215f71f1..0b5b9d44cd 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -411,7 +411,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event,
          * other code perform its own cleanup sequence using vhost_dev data
          * (e.g. vhost_dev_set_log).
          */
-        if (realized) {
+        if (realized && !runstate_check(RUN_STATE_SHUTDOWN)) {
             /*
              * A close event may happen during a read/write, but vhost
              * code assumes the vhost_dev remains setup, so delay the
-- 
MST



  parent reply	other threads:[~2021-04-01 18:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 18:02 [PULL 0/9] pc,virtio,pci: bugfixes Michael S. Tsirkin
2021-04-01 18:02 ` [PULL 1/9] vhost-user-blk: use different event handlers on initialization Michael S. Tsirkin
2021-04-01 18:02 ` [PULL 2/9] vhost-user-blk: perform immediate cleanup if disconnect " Michael S. Tsirkin
2021-04-01 18:02 ` Michael S. Tsirkin [this message]
2021-04-01 18:03 ` [PULL 4/9] virtio-pci: add check for vdev in virtio_pci_isr_read Michael S. Tsirkin
2021-04-01 18:03 ` [PULL 5/9] virtio-pci: remove explicit initialization of val Michael S. Tsirkin
2021-04-01 18:03 ` [PULL 6/9] acpi/piix4: reinitialize acpi PM device on reset Michael S. Tsirkin
2021-04-01 18:03 ` [PULL 7/9] vt82c686.c: don't raise SCI when PCI_INTERRUPT_PIN isn't setup Michael S. Tsirkin
2021-04-01 18:03 ` [PULL 8/9] isa/v582c686: Reinitialize ACPI PM device on reset Michael S. Tsirkin
2021-04-01 18:03 ` [PULL 9/9] pci: sprinkle assert in PCI pin number Michael S. Tsirkin
2021-04-04 20:47 ` [PULL 0/9] pc,virtio,pci: bugfixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210401180235.226321-4-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=den-plotnikov@yandex-team.ru \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).