qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 02/23] block: New BlockBackend


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 02/23] block: New BlockBackend
Date: Mon, 15 Sep 2014 17:54:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Markus Armbruster <address@hidden> writes:

> Markus Armbruster <address@hidden> writes:
>
>> Benoît Canet <address@hidden> writes:
>>
>>>> --- a/block.c
>>>> +++ b/block.c
>>>> @@ -2119,10 +2119,11 @@ static void bdrv_delete(BlockDriverState *bs)
>>>>  
>>>>      bdrv_close(bs);
>>>>  
>>>
>>>
>>>> +    drive_info_del(drive_get_by_blockdev(bs));
>>>> +
>>>>      /* remove from list, if necessary */
>>>>      bdrv_make_anon(bs);
>>>>  
>>>> -    drive_info_del(drive_get_by_blockdev(bs));
>>>
>>> Do we really want this move ?
>>
>> Yes, we do.  If bdrv_make_anon() runs before drive_info_del(), this
>> conditional in drive_info_del() is always false:
>>
>>     if (dinfo->bdrv->device_name[0]) {
>>         blk_unref(blk_by_name(dinfo->bdrv->device_name));
>>     }
>>
>> I apologize for the hairiness.  Things will become *way* simpler in
>> PATCH 4.
>
> It's not just temporarily hairy, it's temporarily wrong: double unref is
> possible.

Clarification: wrong in my tree, after I tried to plug the leak Max
found in PATCH 3.  v2 as posted has no double unref.

I'm afraid getting this exactly right at every step is too hard to be
worth it.  I think I'll go for a temporary memory leak in v3.

> drive_del, the gift that keeps on giving...
>
> [...]



reply via email to

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