From: Kevin Wolf <kwolf@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/6] luks: Create block_crypto_co_create_generic()
Date: Tue, 14 May 2019 19:53:15 +0200 [thread overview]
Message-ID: <20190514175315.GC18881@linux.fritz.box> (raw)
In-Reply-To: <20190514111330.GA8548@redhat.com>
Am 14.05.2019 um 13:13 hat Daniel P. Berrangé geschrieben:
> On Mon, Mar 12, 2018 at 04:02:14PM +0100, Kevin Wolf wrote:
> > Everything that refers to the protocol layer or QemuOpts is moved out of
> > block_crypto_create_generic(), so that the remaining function is
> > suitable to be called by a .bdrv_co_create implementation.
> >
> > LUKS is the only driver that actually implements the old interface, and
> > we don't intend to use it in any new drivers, so put the moved out code
> > directly into a LUKS function rather than creating a generic
> > intermediate one.
> >
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > Reviewed-by: Eric Blake <eblake@redhat.com>
> > ---
> > block/crypto.c | 95 +++++++++++++++++++++++++++++++++++++---------------------
> > 1 file changed, 61 insertions(+), 34 deletions(-)
>
>
> Reviving a year old commit...
>
> The LUKS driver doesn't implement preallocation during create.
>
> Before this commit this would be reported
>
> $ qemu-img create -f luks --object secret,id=sec0,data=base -o key-secret=sec0 base.luks 1G -o preallocation=full
> Formatting 'base.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=full
> qemu-img: base.luks: Parameter 'preallocation' is unexpected
>
> After this commit, there is no error reported - it just silently
> ignores the preallocation=full option.
>
> I'm a bit lost in block layer understanding where is the right
> place to fix the error reporting in this case.
Hmm, this looked strange at first, but I see now where the difference
is.
In the old state, crypto used qemu_opts_to_qdict() and then fed all
options to its own visitor. I'm not sure whether I can clearly call this
a bug, but it's different from other format drivers, which parse all
options they know and pass the rest to the protocol driver.
The new version was converted to use qemu_opts_to_qdict_filtered() like
in all other drivers, so we got the same behaviour in crypto: Unknown
options are passed to the protocol.
As it happens, file-posix does support 'preallocation', so the operation
will return success now. Of course, passing the preallocation to the
protocol level is questionable for non-raw image formats, and completely
useless when you create the protocol level with size 0 and you'll call
blk_truncate() later.
I think we would get back to the old state if you just changed the
qemu_opts_to_qdict_filtered() call back to qemu_opts_to_qdict(). But it
make the driver inconsistent with other drivers again.
Maybe the best way to solve this would be to just implement
preallocation. It should be as easy as adding a 'preallocation' create
option (in QAPI and block_crypto_create_opts_luks), putting the
PreallocMode into BlockCryptoCreateData and then passing it to the
blk_truncate() call in block_crypto_init_func().
Kevin
next prev parent reply other threads:[~2019-05-14 17:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 15:02 [Qemu-devel] [PATCH v2 0/6] luks: Implement .bdrv_co_create Kevin Wolf
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 1/6] luks: Separate image file creation from formatting Kevin Wolf
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 2/6] luks: Create block_crypto_co_create_generic() Kevin Wolf
2019-05-14 11:13 ` Daniel P. Berrangé
2019-05-14 17:53 ` Kevin Wolf [this message]
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 3/6] luks: Support .bdrv_co_create Kevin Wolf
2018-03-12 16:03 ` Daniel P. Berrangé
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 4/6] luks: Turn invalid assertion into check Kevin Wolf
2018-03-12 16:03 ` Daniel P. Berrangé
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 5/6] luks: Catch integer overflow for huge sizes Kevin Wolf
2018-03-12 15:02 ` [Qemu-devel] [PATCH v2 6/6] qemu-iotests: Test luks QMP image creation Kevin Wolf
2018-03-12 16:06 ` Daniel P. Berrangé
2018-03-12 16:34 ` [Qemu-devel] [PATCH v2 0/6] luks: Implement .bdrv_co_create Kevin Wolf
2018-03-12 17:59 ` no-reply
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=20190514175315.GC18881@linux.fritz.box \
--to=kwolf@redhat.com \
--cc=berrange@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).