[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 5/7] migration: omit drive ref as we have bdr

From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 5/7] migration: omit drive ref as we have bdrv_ref now
Date: Fri, 2 Aug 2013 17:04:32 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Aug 02, 2013 at 04:13:55PM +0800, Wenchao Xia wrote:
> There should be a section of code in device hot unplug, checking
> DriverInfo's ref, fail or do nothing when ref != 1. But I haven't found
> that code, so not sure whether this patch will change the behavior in
> device hot unplug.

It is not necessary to refuse device hot unplug when bs.ref > 0.  But a
couple of fixes are required to make it safe:

DriveInfo always holds a BDS refcount, so BDS can never be deleted while
the DriveInfo exists.

DriveInfo is the metadata that connects an emulated storage controller
with its BDS.  Therefore, hot unplugging an emulated storage controller
may release the last DriveInfo reference and delete it.

Anything that still holds the BDS reference when DriveInfo is deleted
will keep the BDS alive.  It turns out that a lot of commands only use
BDS with bdrv_find(), not DriveInfo, so you can continue to do useful
things with the BDS after its DriveInfo is deleted.

The problem
A couple of places have not been converted to use bdrv_ref() yet, so
they still go through drive_get_ref(drive_get_by_blockdev(bs)).  These
cases will now fail!  I pointed out the blockjob cases but please grep
to make sure there are no others.

You need to fix them before this series is safe, otherwise
drive_put_ref(NULL) will segfault!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]