qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a


From: Alberto Garcia
Subject: Re: [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS
Date: Tue, 09 Feb 2016 11:47:32 +0100
User-agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu)

On Tue 09 Feb 2016 11:32:20 AM CET, Kevin Wolf <address@hidden> wrote:
>> When x-blockdev-del is performed on a BlockBackend that has inserted
>> media it will only succeed if the BDS doesn't have any additional
>> references.
>> 
>> The only problem with this is that if the BDS was created separately
>> using blockdev-add then the backend won't be able to be destroyed
>> unless the BDS is ejected first. This is an unnecessary restriction.
>> 
>> Now that we have a list of monitor-owned BDSs we can allow
>> x-blockdev-del to work in this scenario if the BDS has exactly one
>> extra reference and that reference is from the monitor.
>> 
>> Signed-off-by: Alberto Garcia <address@hidden>
>
> This means that what you created with two blockdev-add commands would be
> destroyed with a single blockdev-del command. I think we all agreed that
> blockdev-add and blockdev-del should always come in pairs.

No, no. I think you are misunderstanding the use case.

Consider this example (testAttachMedia() from iotest 139):

1) blockdev-add creates 'drive0' with a BDS called 'node0'
2) 'node0' is removed from 'drive0' (and therefore destroyed)
3) 'node1' is added using blockdev-add
4) 'node1' is inserted into 'drive0'

Now we want to destroy both 'drive0' and 'node1'. With the current code
we can only do it like this:

5) 'node1' is removed from 'drive0', but not destroyed because it still
    has the monitor reference.
6) 'drive0' is destroyed with x-blockdev-del
7) 'node1' is destroyed with x-blockdev-del

The order of 6) and 7) can be changed without problems. However, 5) is
necessary because otherwise 'x-blockdev-del drive0' won't work ('node1'
has 2 references at that point).

I claim that step 5) should be unnecessary.

If we can guarantee that 'node1' has only two references: the one held
by 'drive0' and the monitor reference, then it should be possible to do
'x-blockdev-del drive0' when 'node1' is inserted.

This would destroy 'drive0' but 'node1' would still remain because of
its monitor reference. Now we can do 'x-blockdev-del node1' and complete
the operation.

Berto



reply via email to

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