All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel <qemu-devel@nongnu.org>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] block-commit & dropping privs
Date: Fri, 3 Apr 2015 15:57:47 -0400	[thread overview]
Message-ID: <20150403195747.GA8600@localhost.localdomain> (raw)
In-Reply-To: <551EEEAD.4050209@redhat.com>

On Fri, Apr 03, 2015 at 01:49:01PM -0600, Eric Blake wrote:
> On 04/02/2015 10:28 PM, Jeff Cody wrote:
> 
> >>
> >> Basically, once a commit crosses more than one file, all intermediate
> >> files are useless and might as well be discarded.
> 
> That's if you do a job-complete operation.  But if you do a job-abort
> operation, the chain is left intact.  What we should probably add is a
> way to do a job-abort operation that leaves the active file intact, but
> which also simultaneously rewrites the backing file of the active image
> to point back to the base image and skip over the intermediate files
> that are now broken.
> 
> >>     But you've pointed out
> >> that by rewriting the backing file of C, we CAN make C still be
> >> consistent and tracking the change since the commit:
> >>
> > 
> > Currently, when we do a commit we drop in the chain all the
> > invalidated intermediate images, and the committed image as well
> > (which is what introduced the bdrv_swap craziness):
> > 
> > [base] <--- [snapA] <--- [snapB] <--- [snapC]
> > 
> > Committing snapB down to the base:
> > 
> > [base] <--- [snapC]  
> > 
> > snapB and snapA are discarded.
> 
> Are we actually changing the backing file metadata of snapC when doing
> this?  And if so, can management applications control the text being
> written (so that it is absolute or relative as desired)?
> 

Yes, and yes: in the QMP block-commit command, there is the optional
argument "backing-file".  If provided, that exact string is written
into snapC as the backing filename.  If not provided, then we use the
"filename" member of the BDS for 'base' (e.g. base_bs->filename);


> > 
> > In the active layer commit, the 'base' that is the recipient of data
> > becomes the new active layer, and we drop all the overlays above it.
> > 
> > If we allow emptying images, we need to either A) empty all images
> > that would have otherwise been dropped, or B) empty the current active 
> > layer, and drop the intermediates.
> > 
> > At first blush, have empty intermediates makes no sense.  But if we
> > consider multi-parent chains, as can be introduced with blockdev-add,
> > perhaps it might:
> > 
> >                                                  /-- [snapE]
> >                                                 /
> > [base] <--- [snapA] <--- [snapB] <--- [snapC] <----- [snapD]
> > 
> > 
> > Say, for performance or cleanup reasons, we want to push snapC into
> > base.  This action invalidates neither snapE or snapD, in theory.
> > 
> > However, in current practice, we drop snapC, snapB, and snapA from
> > the chain. Then either snapE or snapD is now orphaned or worse,
> > depending from which "perspective" the block-commit was done.  But
> > if we just empty snapC, then everything automagically works even in
> > multi-parent chains:
> > 
> >                        /-- [snapE]
> >                       /
> > [base] <---  [snapC] <---- [snapD]
> >              (empty)
> > 
> > So I think it makes sense to provide an option even for the non-active
> > layer block commit case to empty the topmost committed overlay, while
> > dropping the other intermediates.
> 
> At any rate, I'm glad I've got you thinking about it.
> 
> -- 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 

  reply	other threads:[~2015-04-03 19:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  9:07 [Qemu-devel] block-commit & dropping privs Michael Tokarev
2015-03-27 14:49 ` Eric Blake
2015-03-27 15:36   ` Michael Tokarev
2015-03-27 17:12     ` Eric Blake
2015-03-30 15:36       ` Kevin Wolf
2015-04-01  9:26         ` Michael Tokarev
2015-04-01  9:54           ` Michael Tokarev
2015-04-01 12:34             ` Kevin Wolf
2015-04-02 10:58               ` Michael Tokarev
2015-04-02 11:24                 ` Kevin Wolf
2015-04-02 12:04                   ` Michael Tokarev
2015-04-02 13:07                     ` Eric Blake
2015-04-03  4:28                       ` Jeff Cody
2015-04-03 19:49                         ` Eric Blake
2015-04-03 19:57                           ` Jeff Cody [this message]
2015-04-02 13:19                     ` Kevin Wolf
2015-04-06 15:37                       ` Michael Tokarev
2015-04-07  9:24                         ` Kevin Wolf
2015-04-03  3:59                   ` Jeff Cody
2015-04-07  9:18                     ` Kevin Wolf

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=20150403195747.GA8600@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.