From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Hanna Reitz <hreitz@redhat.com>, hujian <hu.jian@zte.com.cn>
Subject: [PULL 1/1] virtio-blk: don't start dataplane during the stop of dataplane
Date: Mon, 16 Oct 2023 15:40:28 -0400 [thread overview]
Message-ID: <20231016194028.163610-2-stefanha@redhat.com> (raw)
In-Reply-To: <20231016194028.163610-1-stefanha@redhat.com>
From: hujian <hu.jian@zte.com.cn>
During the stop of dataplane for virtio-blk, virtio_bus_cleanup_host_notifier() is be
called to clean up notifier at the end, if polled ioeventfd, virtio_blk_handle_output()
is used to handle io request. But due to s->dataplane_disabled is false, it will be
returned directly, which drops io request.
Backtrace:
->virtio_blk_data_plane_stop
->virtio_bus_cleanup_host_notifier
->virtio_queue_host_notifier_read
->virtio_queue_notify_vq
->vq->handle_output
->virtio_blk_handle_output
->if (s->dataplane && !s->dataplane_stoped)
->if (!s->dataplane_disabled)
->return *
->virtio_blk_handle_output_do
The above problem can occur when using "virsh reset" cmdline to reset guest, while
guest does io.
To fix this problem, don't try to start dataplane if s->stopping is true, and io would
be handled by virtio_blk_handle_vq().
Signed-off-by: hujian <hu.jian@zte.com.cn>
Message-id: 202310111414266586398@zte.com.cn
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/block/virtio-blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 39e7f23fab..c2d59389cb 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1166,7 +1166,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOBlock *s = (VirtIOBlock *)vdev;
- if (s->dataplane && !s->dataplane_started) {
+ if (s->dataplane && !s->dataplane_started && !s->stopping) {
/* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start
* dataplane here instead of waiting for .set_status().
*/
--
2.41.0
next prev parent reply other threads:[~2023-10-16 19:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 19:40 [PULL 0/1] Block patches Stefan Hajnoczi
2023-10-16 19:40 ` Stefan Hajnoczi [this message]
2023-10-17 9:01 ` [PULL 1/1] virtio-blk: don't start dataplane during the stop of dataplane Fiona Ebner
2023-10-17 10:02 ` Kevin Wolf
2023-10-17 13:46 ` Stefan Hajnoczi
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=20231016194028.163610-2-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=hreitz@redhat.com \
--cc=hu.jian@zte.com.cn \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).