qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Max Reitz <mreitz@redhat.com>
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	[thread overview]
Message-ID: <w51y4aup3cr.fsf@maestria.local.igalia.com> (raw)
In-Reply-To: <20160209103220.GC8554@noname.redhat.com>

On Tue 09 Feb 2016 11:32:20 AM CET, Kevin Wolf <kwolf@redhat.com> 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 <berto@igalia.com>
>
> 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	other threads:[~2016-02-09 10:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 14:14 Alberto Garcia
2016-02-08 14:14 ` [Qemu-devel] [PATCH 2/3] iotests: Update test 139 after the changes in x-blockdev-del Alberto Garcia
2016-02-09 15:36   ` Eric Blake
2016-02-09 15:44     ` Alberto Garcia
2016-02-08 14:14 ` [Qemu-devel] [PATCH 3/3] block: Update the x-blockdev-del documentation Alberto Garcia
2016-02-09 15:38   ` Eric Blake
2016-02-09 10:32 ` [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS Kevin Wolf
2016-02-09 10:47   ` Alberto Garcia [this message]
2016-02-09 15:34 ` Eric Blake
2016-02-09 15:39   ` Alberto Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=w51y4aup3cr.fsf@maestria.local.igalia.com \
    --to=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --subject='Re: [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).