On 26.06.19 14:39, Sam Eiderman wrote: > We will need to add LCHS removal logic to scsi-hd's unrealize() in the > next commit. > > Reviewed-by: Karl Heubaum <[email protected]> > Reviewed-by: Arbel Moshe <[email protected]> > Signed-off-by: Sam Eiderman <[email protected]> > --- > hw/scsi/scsi-bus.c | 15 +++++++++++++++ > include/hw/scsi/scsi.h | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c > index c480553083..f6fe497a1a 100644 > --- a/hw/scsi/scsi-bus.c > +++ b/hw/scsi/scsi-bus.c
[...]
> @@ -213,11 +221,18 @@ static void scsi_qdev_realize(DeviceState *qdev, Error
> **errp)
> static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
> {
> SCSIDevice *dev = SCSI_DEVICE(qdev);
> + Error *local_err = NULL;
>
> if (dev->vmsentry) {
> qemu_del_vm_change_state_handler(dev->vmsentry);
> }
>
> + scsi_device_unrealize(dev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> +
> scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE));
(I see this code for the first time, but) I suppose I’d put the
scsi_device_unrealize() after scsi_device_purge_requests().
Max
> blockdev_mark_auto_del(dev->conf.blk);
> }
signature.asc
Description: OpenPGP digital signature
