aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-06-25 08:09:10 +0200
committerKevin Wolf <kwolf@redhat.com>2010-07-02 13:18:01 +0200
commit14bafc540774baf316e9ce2474e97d5df6cb8e6c (patch)
treeceb120945adedcbcdaf0bd18bb5558289fe92be6 /hw/scsi-generic.c
parente4700e595ea0b24d5291dbd68deba26d7a955703 (diff)
blockdev: Clean up automatic drive deletion
We automatically delete blockdev host parts on unplug of the guest device. Too much magic, but we can't change that now. The delete happens early in the guest device teardown, before the connection to the host part is severed. Thus, the guest part's pointer to the host part dangles for a brief time. No actual harm comes from this, but we'll catch such dangling pointers a few commits down the road. Clean up the dangling pointers by delaying the automatic deletion until the guest part's pointer is gone. Device usb-storage deliberately makes two qdev properties refer to the same drive, because it automatically creates a second device. Again, too much magic we can't change now. Multiple references worked okay before, but now free_drive() dies for the second one. Zap the extra reference. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index e31060e944..1859c94b7c 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -453,7 +453,7 @@ static void scsi_destroy(SCSIDevice *d)
r = DO_UPCAST(SCSIGenericReq, req, QTAILQ_FIRST(&s->qdev.requests));
scsi_remove_request(r);
}
- drive_uninit(s->qdev.conf.dinfo);
+ blockdev_mark_auto_del(s->qdev.conf.dinfo->bdrv);
}
static int scsi_generic_initfn(SCSIDevice *dev)