Skip to contentSkip to conversation

block: remove 'detached-header' option from opts after use

PATCH Applied Daniel P. Berrangé 3 participants 3 messages Sep 19, 2025 – Sep 24, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: remove 'detached-header' option from opts after use

The code for creating LUKS devices references a 'detached-header' option in the QemuOpts data, but does not consume (remove) the option.

Thus when the code later tries to convert the remaining unused QemuOpts into a QCryptoBlockCreateOptions struct, an error is reported by the QAPI code that 'detached-header' is not a valid field.

This fixes a regression caused by

commit e818c01ae6e7c54c7019baaf307be59d99ce80b9
Author: Daniel P. Berrangé <[email protected]>
Date: Mon Feb 19 15:12:59 2024 +0000

qapi: drop unused QCryptoBlockCreateOptionsLUKS.detached-header

which identified that the QAPI field was unused, but failed to realize the QemuOpts -> QCryptoBlockCreateOptions conversion was seeing the left-over 'detached-header' optino which had not been removed from QemuOpts.

This problem was identified by the 'luks-detached-header' I/O test, but unfortunate I/O tests are not run regularly for the LUKS format.

Fixes e818c01ae6e7c54c7019baaf307be59d99ce80b9
---
 block/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/crypto.c +1 -1
index d4226cc68a..17b4749a1e 100644
@@ -792,7 +792,7 @@ block_crypto_co_create_opts_luks(BlockDriver *drv, const char *filename,
     char *buf = NULL;
     int64_t size;
     bool detached_hdr =
-        qemu_opt_get_bool(opts, "detached-header", false);
+        qemu_opt_get_bool_del(opts, "detached-header", false);
     unsigned int cflags = 0;
     int ret;
     Error *local_err = NULL;
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Daniel P. Berrangé

The code for creating LUKS devices references a 'detached-header' option in the QemuOpts data, but does not consume (remove) the option.

Thus when the code later tries to convert the remaining unused QemuOpts into a QCryptoBlockCreateOptions struct, an error is reported by the QAPI code that 'detached-header' is not a valid field.

This fixes a regression caused by

commit e818c01ae6e7c54c7019baaf307be59d99ce80b9
Author: Daniel P. Berrangé <[email protected]>
Date: Mon Feb 19 15:12:59 2024 +0000

Quoted 5 lines

qapi: drop unused QCryptoBlockCreateOptionsLUKS.detached-header

which identified that the QAPI field was unused, but failed to realize the QemuOpts -> QCryptoBlockCreateOptions conversion was seeing the left-over 'detached-header' optino which had not

option

Quoted 6 lines

been removed from QemuOpts.

This problem was identified by the 'luks-detached-header' I/O test, but unfortunate I/O tests are not run regularly for the LUKS format.

Quoted 6 lines
Fixes e818c01ae6e7c54c7019baaf307be59d99ce80b9
---
 block/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 18 lines
block/crypto.c +1 -1
index d4226cc68a..17b4749a1e 100644
@@ -792,7 +792,7 @@ block_crypto_co_create_opts_luks(BlockDriver *drv, const char *filename,
     char *buf = NULL;
     int64_t size;
     bool detached_hdr =
-        qemu_opt_get_bool(opts, "detached-header", false);
+        qemu_opt_get_bool_del(opts, "detached-header", false);
     unsigned int cflags = 0;
     int ret;
     Error *local_err = NULL;
Signature · 1 line
2.50.1
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
Applied
#2 lore raw

Am 22.09.2025 um 14:37 hat Eric Blake geschrieben:

Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines

The code for creating LUKS devices references a 'detached-header' option in the QemuOpts data, but does not consume (remove) the option.

Thus when the code later tries to convert the remaining unused QemuOpts into a QCryptoBlockCreateOptions struct, an error is reported by the QAPI code that 'detached-header' is not a valid field.

This fixes a regression caused by

commit e818c01ae6e7c54c7019baaf307be59d99ce80b9
Author: Daniel P. Berrangé <[email protected]>
Date: Mon Feb 19 15:12:59 2024 +0000

Quoted 12 lines
Quoted 5 lines

qapi: drop unused QCryptoBlockCreateOptionsLUKS.detached-header

which identified that the QAPI field was unused, but failed to realize the QemuOpts -> QCryptoBlockCreateOptions conversion was seeing the left-over 'detached-header' optino which had not

option

Quoted 4 lines

been removed from QemuOpts.

This problem was identified by the 'luks-detached-header' I/O test, but unfortunate I/O tests are not run regularly for the

I assume this should be "unfortunately".

Quoted 10 lines
Quoted 8 lines

LUKS format.

Fixes e818c01ae6e7c54c7019baaf307be59d99ce80b9
---
 block/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to the block branch.

Kevin