qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 04/11] block: use refcnt for device attach/de


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 04/11] block: use refcnt for device attach/detach
Date: Tue, 23 Jul 2013 11:44:17 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jul 17, 2013 at 05:42:09PM +0800, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  block.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block.c b/block.c
> index 7b46669..57a3876 100644
> --- a/block.c
> +++ b/block.c
> @@ -1622,6 +1622,7 @@ int bdrv_attach_dev(BlockDriverState *bs, void *dev)
>          return -EBUSY;
>      }
>      bs->dev = dev;
> +    bdrv_ref(bs, false);
>      bdrv_iostatus_reset(bs);
>      return 0;
>  }
> @@ -1639,6 +1640,7 @@ void bdrv_detach_dev(BlockDriverState *bs, void *dev)
>  {
>      assert(bs->dev == dev);
>      bs->dev = NULL;
> +    bdrv_unref(bs, false);
>      bs->dev_ops = NULL;
>      bs->dev_opaque = NULL;
>      bs->buffer_alignment = 512;

I'm not 100% sure about this.  sd_init() and
ide_init2_with_non_qdev_drives() call bdrv_attach_dev_nofail() but I
don't see a bdrv_detach_dev() call.

It may be necessary to audit the lifecycle of emulated storage
controllers more closely before the refcounts work correctly.



reply via email to

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