blockdev: add refcount to DriveInfo

The host part of a block device can be deleted with in progress
block migration.

To fix this, add a reference count to DriveInfo, freeing resources
on last reference.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Marcelo Tosatti 2011-01-26 12:12:32 -02:00 committed by Kevin Wolf
parent 8f794c557c
commit 84fb392526
3 changed files with 20 additions and 4 deletions

View file

@ -147,7 +147,7 @@ void drive_hot_add(Monitor *mon, const QDict *qdict)
err:
if (dinfo)
drive_uninit(dinfo);
drive_put_ref(dinfo);
return;
}