On Thu, Mar 12, 2026 at 06:42:53PM +0100, Joshua Daley wrote: > Changelog v1 -> v2: > > - Added 2 additional patches: > - [PATCH v2 1/3] scsi: virtio_scsi: kick event_list unconditionally > - Removes the conditions surrounding event_list operations (suggested by > Stefan Hajnoczi <[email protected]>) > - [PATCH v2 2/3] scsi: virtio_scsi: remove unnecessary fn declaration > - Removes virtscsi_handle_event() prototype (suggested by Eric Farman > <[email protected]>) > > - [PATCH 1/1] -> [PATCH v2 3/3] scsi: virtio_scsi: move INIT_WORK calls to > virtscsi_init > - Removed the condition surrounding INIT_WORK calls > > ----- > > v1 cover letter: > > This patch avoids a kernel warning that may occur if a virtio_scsi > controller is detached immediately following a disk detach. See the > commit message for details. The following are instructions to > produce the warning (without the proposed patch). > > Timing matters--if all event work items call INIT_WORK before they are > flushed by cancel_work_sync, then the warning will not occur. > > The warning will occur consistently if a sleep is added in > virtscsi_kick_event before the INIT_WORK call, like so: > > #include <linux/delay.h> > > static int virtscsi_kick_event(struct virtio_scsi *vscsi, > struct virtio_scsi_event_node *event_node) > { > int err; > struct scatterlist sg; > unsigned long flags; > > -> msleep(1000); > INIT_WORK(&event_node->work, virtscsi_handle_event); > > ... > } > > Then, just detach a disk and its controller in quick succession: > > virsh detach-device --domain <domain> disk.xml; \ > virsh detach-device --domain <domain> controller.xml > > where disk.xml and controller.xml are text files containing the XML > of the disk and controller. > > Or, with the libvirt python module: > > domain.detachDevice(str(disk_xml)) > domain.detachDevice(str(controller_xml)) > > Joshua Daley (3): > scsi: virtio_scsi: kick event_list unconditionally > scsi: virtio_scsi: remove unnecessary fn declaration > scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init > > drivers/scsi/virtio_scsi.c | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > > -- > 2.34.1 >
Reviewed-by: Stefan Hajnoczi <[email protected]>
signature.asc
Description: PGP signature

