qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
@ 2018-01-18 10:31 Daniel P. Berrange
  2018-01-18 19:51 ` Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Daniel P. Berrange @ 2018-01-18 10:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Max Reitz, Kevin Wolf, Daniel P. Berrange

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(+)

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 */
+    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,
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  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
  2018-01-19  9:25   ` Daniel P. Berrange
  2018-01-31 18:27 ` Max Reitz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2018-01-18 19:51 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  2018-01-18 19:51 ` Eric Blake
@ 2018-01-19  9:25   ` Daniel P. Berrange
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel P. Berrange @ 2018-01-19  9:25 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, Kevin Wolf, qemu-block, Max Reitz

On Thu, Jan 18, 2018 at 01:51:36PM -0600, Eric Blake wrote:
> 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.

Yeah, likewise - it is hard to understand what is required, but I see
lots of other block drivers just put a no-op impl here. I'm relying on
Kevin/Max to tell me if i'm wrong here 

> > 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?

LUKS doesn't do anything differently with ro vs rw images, so I'm assuming
any such checks are handled by the layer below.



> 
> > +    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,

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  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
@ 2018-01-31 18:27 ` Max Reitz
  2018-02-16 13:53 ` Daniel P. Berrangé
  2018-03-06 11:18 ` Kevin Wolf
  3 siblings, 0 replies; 7+ messages in thread
From: Max Reitz @ 2018-01-31 18:27 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: qemu-block, Kevin Wolf

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

On 2018-01-18 11:31, 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(+)
> 
> 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 */
> +    return 0;
> +}

Unfortunately I have to admit I'm not quite an expert on reopen
myself...  But generally it is used to change options, so in theory one
could provide a new key-secret here.  It's up to you whether you want to
support that or not (with this implementation the user will get an error
when they want to change the key-secret).

Apart from that, I think a no-op should be OK.

Max

>  
>  /*
>   * 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,
> 



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  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
  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
  3 siblings, 1 reply; 7+ messages in thread
From: Daniel P. Berrangé @ 2018-02-16 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Max Reitz, Kevin Wolf

Ping, can this be queued in the block tree, since it appears the no-op impl
is ok ?

On Thu, Jan 18, 2018 at 10:31:43AM +0000, 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(+)
> 
> 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 */
> +    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,
> -- 
> 2.14.3
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  2018-02-16 13:53 ` Daniel P. Berrangé
@ 2018-03-06 10:35   ` Daniel P. Berrangé
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel P. Berrangé @ 2018-03-06 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

Ping 

On Fri, Feb 16, 2018 at 01:53:12PM +0000, Daniel P. Berrangé wrote:
> Ping, can this be queued in the block tree, since it appears the no-op impl
> is ok ?
> 
> On Thu, Jan 18, 2018 at 10:31:43AM +0000, 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(+)
> > 
> > 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 */
> > +    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,
> > -- 
> > 2.14.3
> > 
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver
  2018-01-18 10:31 [Qemu-devel] [PATCH] block: implement the bdrv_reopen_prepare helper for LUKS driver Daniel P. Berrange
                   ` (2 preceding siblings ...)
  2018-02-16 13:53 ` Daniel P. Berrangé
@ 2018-03-06 11:18 ` Kevin Wolf
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2018-03-06 11:18 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel, qemu-block, Max Reitz

Am 18.01.2018 um 11:31 hat Daniel P. Berrange geschrieben:
> 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>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-06 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).