From: Maxim Levitsky <mlevitsk@redhat.com>
To: qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Paolo Bonzini <pbonzini@redhat.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH 1/3] scsi: virtio-scsi: don't process IO on fenced dataplane
Date: Thu, 17 Dec 2020 17:00:38 +0200 [thread overview]
Message-ID: <20201217150040.906961-2-mlevitsk@redhat.com> (raw)
In-Reply-To: <20201217150040.906961-1-mlevitsk@redhat.com>
If virtio_scsi_dataplane_start fails, there is a small window when it drops the
aio lock (in aio_wait_bh_oneshot) and the dataplane's AIO handler can
still run during that window.
This is done after the dataplane was marked as fenced, thus we use this flag
to avoid it doing any IO.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
hw/scsi/virtio-scsi-dataplane.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index b995bab3a2..2824a25b65 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -56,8 +56,10 @@ static bool virtio_scsi_data_plane_handle_cmd(VirtIODevice *vdev,
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
virtio_scsi_acquire(s);
- assert(s->ctx && s->dataplane_started);
- progress = virtio_scsi_handle_cmd_vq(s, vq);
+ if (!s->dataplane_fenced) {
+ assert(s->ctx && s->dataplane_started);
+ progress = virtio_scsi_handle_cmd_vq(s, vq);
+ }
virtio_scsi_release(s);
return progress;
}
@@ -69,8 +71,10 @@ static bool virtio_scsi_data_plane_handle_ctrl(VirtIODevice *vdev,
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
virtio_scsi_acquire(s);
- assert(s->ctx && s->dataplane_started);
- progress = virtio_scsi_handle_ctrl_vq(s, vq);
+ if (!s->dataplane_fenced) {
+ assert(s->ctx && s->dataplane_started);
+ progress = virtio_scsi_handle_ctrl_vq(s, vq);
+ }
virtio_scsi_release(s);
return progress;
}
@@ -82,8 +86,10 @@ static bool virtio_scsi_data_plane_handle_event(VirtIODevice *vdev,
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
virtio_scsi_acquire(s);
- assert(s->ctx && s->dataplane_started);
- progress = virtio_scsi_handle_event_vq(s, vq);
+ if (!s->dataplane_fenced) {
+ assert(s->ctx && s->dataplane_started);
+ progress = virtio_scsi_handle_event_vq(s, vq);
+ }
virtio_scsi_release(s);
return progress;
}
--
2.26.2
next prev parent reply other threads:[~2020-12-17 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 15:00 [PATCH 0/3] RFC: few random hacks to improve eventfd fallback path Maxim Levitsky
2020-12-17 15:00 ` Maxim Levitsky [this message]
2020-12-17 15:00 ` [PATCH 2/3] virtio-scsi: don't uninitialize queues that we didn't initialize Maxim Levitsky
2020-12-17 15:00 ` [PATCH 3/3] event_notifier: handle initialization failure better Maxim Levitsky
2021-01-07 10:26 ` [PATCH 0/3] RFC: few random hacks to improve eventfd fallback path Maxim Levitsky
2021-01-13 14:38 ` Paolo Bonzini
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=20201217150040.906961-2-mlevitsk@redhat.com \
--to=mlevitsk@redhat.com \
--cc=fam@euphon.net \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--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).