You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/qapi
Kevin Wolf 4af976ef39 rbd: Fix .bdrv_get_specific_info implementation
qemu_rbd_get_specific_info() has at least two problems:

The first is that it issues a blocking rbd_read() call in order to probe
the encryption format for the image while querying the node. This means
that if the connection to the server goes down, not only I/O is stuck
(which is unavoidable), but query-names-block-nodes will actually make
the whole QEMU instance unresponsive. .bdrv_get_specific_info
implementations shouldn't perform blocking operations, but only return
what is already known.

The second is that the information returned isn't even correct. If the
image is already opened with encryption enabled at the RBD level, we'll
probe for "double encryption", i.e. if the encrypted data contains
another encryption header. If it doesn't (which is the normal case), we
won't return the encryption format. If it does, we return misleading
information because it looks like we're talking about the outer level
(the encryption format of the image itself) while the information is
about an encryption header in the guest data.

Fix this by storing the encryption format in BDRVRBDState when the image
is opened (and we do blocking operations anyway) and returning only the
stored information in qemu_rbd_get_specific_info().

The information we'll store is either the actual encryption format that
we enabled on the RBD level, or if the image is unencrypted, the result
of the same probing as we previously did when querying the node. Probing
image formats based on content that can be modified by the guest has
long been known as problematic, but as long as we only output it to the
user instead of making decisions based on it, it should be okay. It is
undoubtedly useful in the context of 'qemu-img info' when you're trying
to figure out which encryption options you have to use to open the
image successfully.

Fixes: 42e4ac9ef5 ("block/rbd: Add support for rbd image encryption")
Buglink: https://issues.redhat.com/browse/RHEL-105440
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250811134010.81787-1-kwolf@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 weeks ago
..
accelerator.json qapi/accelerator: Fix markup of heading 1 month ago
acpi.json qapi: add cross-references to acpi.json 2 months ago
audio.json qapi: remove trivial "Returns:" sections 2 months ago
authz.json qapi: add cross-references to authz.json 2 months ago
block-core.json rbd: Fix .bdrv_get_specific_info implementation 4 weeks ago
block-export.json qapi: add cross-references to block layer 2 months ago
block.json qapi: add cross-references to block layer 2 months ago
char.json qapi: remove trivial "Returns:" sections 2 months ago
common.json docs/sphinx: remove special parsing for freeform sections 2 months ago
compat.json docs/sphinx: remove special parsing for freeform sections 2 months ago
control.json qapi: add cross-references to misc modules 2 months ago
crypto.json qapi: add cross-references to crypto.json 2 months ago
cryptodev.json qapi: remove trivial "Returns:" sections 2 months ago
cxl.json docs/sphinx: remove special parsing for freeform sections 2 months ago
dump.json qapi: Add more cross-references 1 month ago
ebpf.json qapi: add cross-references to misc modules 2 months ago
error.json docs/sphinx: remove special parsing for freeform sections 2 months ago
introspect.json qapi: add cross-references to misc modules 2 months ago
job.json qapi: add cross-references to job.json 2 months ago
machine-common.json qapi: add cross-references to Machine core 2 months ago
machine-s390x.json qapi: make s390x specific CPU commands unconditionally available 3 months ago
machine.json qapi: Add more cross-references 1 month ago
meson.build qapi/accel: Move definitions related to accelerators in their own file 2 months ago
migration.json qapi: Add more cross-references 1 month ago
misc-arm.json qapi: add cross-references to misc modules 2 months ago
misc-i386.json qapi: Add more cross-references 1 month ago
misc.json qapi: add cross-references to misc modules 2 months ago
net.json QAPI patches patches for 2025-07-14 2 months ago
opts-visitor.c qapi: Inline and remove QERR_INVALID_PARAMETER definition 1 year ago
pci.json qapi: add cross-references to pci.json 2 months ago
pragma.json qapi: Document QCryptodevBackendServiceType 11 months ago
qapi-clone-visitor.c qapi: Move include/qapi/qmp/ to include/qobject/ 7 months ago
qapi-dealloc-visitor.c qapi: Move include/qapi/qmp/ to include/qobject/ 7 months ago
qapi-forward-visitor.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qapi-schema.json Accelerators patches 2 months ago
qapi-type-helpers.c qapi: New strv_from_str_list() 2 years ago
qapi-util.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qapi-visit-core.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qdev.json qapi: add cross-references to QOM 2 months ago
qmp-dispatch.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qmp-event.c qapi: Move include/qapi/qmp/ to include/qobject/ 7 months ago
qmp-registry.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qobject-input-visitor.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qobject-output-visitor.c qapi: change 'unsigned special_features' to 'uint64_t features' 7 months ago
qom.json qom: qom-list-get 2 months ago
replay.json qapi: add cross-references to replay.json 2 months ago
rocker.json qapi: remove trivial "Returns:" sections 2 months ago
run-state.json qapi: Add more cross-references 1 month ago
sockets.json qapi: Add more cross-references 1 month ago
stats.json qapi: add cross-references to misc modules 2 months ago
string-input-visitor.c qapi: Move include/qapi/qmp/ to include/qobject/ 7 months ago
string-output-visitor.c string-output-visitor: Fix (pseudo) struct handling 2 years ago
tpm.json qapi: remove trivial "Returns:" sections 2 months ago
trace-events
trace.h
trace.json qapi: rephrase return docs to avoid type name 2 months ago
transaction.json qapi: add cross-references to block layer 2 months ago
uefi.json docs/sphinx: remove special parsing for freeform sections 2 months ago
ui.json QAPI patches patches for 2025-07-14 2 months ago
vfio.json docs/sphinx: remove special parsing for freeform sections 2 months ago
virtio.json QAPI patches patches for 2025-07-14 2 months ago
yank.json qapi: add cross-references to yank.json 2 months ago