qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
Date: Thu, 18 Jan 2018 13:51:36 -0600	[thread overview]
Message-ID: <11124de8-ece3-cad5-7e43-0b10ce5c097d@redhat.com> (raw)
In-Reply-To: <20180118103143.11780-1-berrange@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

On 01/18/2018 04:31 AM, Daniel P. Berrange wrote:
> If the bdrv_reopen_prepare helper isn't provided, the qemu-img commit
> command fails to re-open the base layer after committing changes into
> it. Provide a no-op implementation for the LUKS driver, since there
> is not any custom work that needs doing to re-open it.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  block/crypto.c | 7 +++++++
>  1 file changed, 7 insertions(+)

I'm hoping another block-layer expert chimes in, as I'm not quite sure
what the full reopen rules are; but the idea makes sense to me.

> 
> diff --git a/block/crypto.c b/block/crypto.c
> index 60ddf8623e..bb9a8f5376 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -382,6 +382,12 @@ static void block_crypto_close(BlockDriverState *bs)
>      qcrypto_block_free(crypto->block);
>  }
>  
> +static int block_crypto_reopen_prepare(BDRVReopenState *state,
> +                                       BlockReopenQueue *queue, Error **errp)
> +{
> +    /* nothing needs checking */

Are we sure that even changes such as moving from read-only to
read-write need no checking?

> +    return 0;
> +}
>  
>  /*
>   * 1 MB bounce buffer gives good performance / memory tradeoff
> @@ -620,6 +626,7 @@ BlockDriver bdrv_crypto_luks = {
>      .bdrv_truncate      = block_crypto_truncate,
>      .create_opts        = &block_crypto_create_opts_luks,
>  
> +    .bdrv_reopen_prepare = block_crypto_reopen_prepare,
>      .bdrv_refresh_limits = block_crypto_refresh_limits,
>      .bdrv_co_preadv     = block_crypto_co_preadv,
>      .bdrv_co_pwritev    = block_crypto_co_pwritev,
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2018-01-18 19:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 10:31 [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver Daniel P. Berrange
2018-01-18 19:51 ` Eric Blake [this message]
2018-01-19  9:25   ` Daniel P. Berrange
2018-01-31 18:27 ` Max Reitz
2018-02-16 13:53 ` Daniel P. Berrangé
2018-03-06 10:35   ` Daniel P. Berrangé
2018-03-06 11: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=11124de8-ece3-cad5-7e43-0b10ce5c097d@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --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 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).