Markus Armbruster <arm...@redhat.com> writes: > Kevin Wolf <kw...@redhat.com> writes: [...] >>> diff --git a/blockdev.c b/blockdev.c >>> index 9fbd888..86596bc 100644 >>> --- a/blockdev.c >>> +++ b/blockdev.c [...] >>> @@ -1770,7 +1778,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, >>> QObject **ret_data) >>> */ >>> if (bdrv_get_attached_dev(bs)) { >>> bdrv_make_anon(bs); >>> - >>> + blk_unref(blk_by_name(id)); >>> /* Further I/O must not pause the guest */ >>> bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT, >>> BLOCKDEV_ON_ERROR_REPORT); >> >> Won't we unref the BB a second time now when unplugging the device? >> (drive_del() called in blockdev_auto_del()) > > Short answer: you're right, there's a bug, and I'll fix it. > > Long answer: this part is hairy, because the drive_del command is badly > designed. [...] > Simplest possible solution: I hide the BB here, and *leak* it (with a > fat FIXME comment) until it becomes easy enough to find. I guess I can > find it right in the next patch.
Nevermind, I found a tolerable way to avoid the temporary leak.