Virtuozzo QEMU development (svt-core@virtuozzo.com)
 help / color / mirror / Atom feed
* [PATCH hci-8.1 0/1] virtio-scsi: fix hot-plugged disk invisible in the guest #VSTOR-151351
@ 2026-10-26 11:11 Denis V. Lunev
  2026-10-26 11:11 ` [PATCH hci-8.1 1/1] virtio-scsi: fix hot-plug event racing device realize #VSTOR-151351 Denis V. Lunev
  0 siblings, 1 reply; 4+ messages in thread
From: Denis V. Lunev @ 2026-10-26 11:11 UTC (permalink / raw)
  To: andrey.drobyshev; +Cc: svt-core, den

A disk or CD-ROM hot-plugged into virtio-scsi sometimes never shows up
in the guest until the bus is rescanned by hand. CI hits it with Windows
Server guests (vioscsi) and with Linux guests, always with the controller
on an iothread: VSTOR-151351, VSTOR-147722, VSTOR-150741 and the Linux
tickets VSTOR-146483, 146499, 146614 and 147072.

The RESCAN event is pushed from the plug() callback, before the device
is realized, and the iothread request path does not see unrealized
devices. A guest that scans right away gets BAD_TARGET and does not
retry. The patch moves the event to a main-loop bottom half. Ilya Rudakov
found the cause.

This is the patch posted to qemu-devel on 2026-10-23, not yet merged:
https://lore.kernel.org/qemu-devel/20261023162000.2796947-1-den@openvz.org/
The only difference is the non-const HotplugHandler argument of
virtio_scsi_hotplug() in our tree.

There is no test in the patch: a qtest or iotests client is served by
the main loop and cannot get a request into the window inside
device_add. On the upstream build, a Linux guest with the main thread
stalled for 3 s in scsi_bus_set_ua() under gdb missed the hot-plugged
LUN in 3 of 3 runs without the fix and saw it in 3 of 3 with it. On this
tree, hw/scsi/virtio-scsi.c only has been build-checked.

Signed-off-by: Denis V. Lunev <den@openvz.org>

Denis V. Lunev (1):
  virtio-scsi: fix hot-plug event racing device realize #VSTOR-151351

 hw/scsi/virtio-scsi.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)


base-commit: f3c1d9ef263edfab8d2a273078493bb766dcf8f8
-- 
2.53.0


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

end of thread, other threads:[~2026-10-26 11:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 11:11 [PATCH hci-8.1 0/1] virtio-scsi: fix hot-plugged disk invisible in the guest #VSTOR-151351 Denis V. Lunev
2026-10-26 11:11 ` [PATCH hci-8.1 1/1] virtio-scsi: fix hot-plug event racing device realize #VSTOR-151351 Denis V. Lunev
2026-10-26 11:14   ` no-reply
2026-10-26 11:29   ` Andrey Drobyshev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox