On Mon, Dec 18, 2023 at 1:41 PM Fiona Ebner <f.eb...@proxmox.com> wrote: > I think it's because of nested drains, because when additionally > checking that the drain count is zero and only executing the loop then, > that issue doesn't seem to manifest
But isn't virtio_scsi_drained_end only run if bus->drain_count == 0? if (bus->drain_count-- == 1) { trace_scsi_bus_drained_end(bus, sdev); if (bus->info->drained_end) { bus->info->drained_end(bus); } } Paolo > > > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c > > index 9c751bf296..d22c586b38 100644 > > --- a/hw/scsi/virtio-scsi.c > > +++ b/hw/scsi/virtio-scsi.c > > @@ -1164,9 +1164,13 @@ static void virtio_scsi_drained_end(SCSIBus *bus) > > return; > > } > > > > - for (uint32_t i = 0; i < total_queues; i++) { > > - VirtQueue *vq = virtio_get_queue(vdev, i); > > - virtio_queue_aio_attach_host_notifier(vq, s->ctx); > > + if (s->bus.drain_count == 0) { > > + for (uint32_t i = 0; i < total_queues; i++) { > > + VirtQueue *vq = virtio_get_queue(vdev, i); > > + virtio_queue_set_notification(vq, 1); > > + virtio_queue_notify(vdev, i); > > + virtio_queue_aio_attach_host_notifier(vq, s->ctx); > > + } > > } > > } > > > > Best Regards, > Fiona >