[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 24/27] block: Fix invalidate_cache error path for par
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 24/27] block: Fix invalidate_cache error path for parent activation |
Date: |
Fri, 1 Feb 2019 17:35:15 +0100 |
bdrv_co_invalidate_cache() clears the BDRV_O_INACTIVE flag before
actually activating a node so that the correct permissions etc. are
taken. In case of errors, the flag must be restored so that the next
call to bdrv_co_invalidate_cache() retries activation.
Restoring the flag was missing in the error path for a failed
parent->role->activate() call. The consequence is that this attempt to
activate all images correctly fails because we still set errp, however
on the next attempt BDRV_O_INACTIVE is already clear, so we return
success without actually retrying the failed action.
An example where this is observable in practice is migration to a QEMU
instance that has a raw format block node attached to a guest device
with share-rw=off (the default) while another process holds
BLK_PERM_WRITE for the same image. In this case, all activation steps
before parent->role->activate() succeed because raw can tolerate other
writers to the image. Only the parent callback (in particular
blk_root_activate()) tries to implement the share-rw=on property and
requests exclusive write permissions. This fails when the migration
completes and correctly displays an error. However, a manual 'cont' will
incorrectly resume the VM without calling blk_root_activate() again.
This case is described in more detail in the following bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1531888
Fix this by correctly restoring the BDRV_O_INACTIVE flag in the error
path.
Cc: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
Tested-by: Markus Armbruster <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index 5a4d27173e..b67d9b7b65 100644
--- a/block.c
+++ b/block.c
@@ -4697,6 +4697,7 @@ static void coroutine_fn
bdrv_co_invalidate_cache(BlockDriverState *bs,
if (parent->role->activate) {
parent->role->activate(parent, &local_err);
if (local_err) {
+ bs->open_flags |= BDRV_O_INACTIVE;
error_propagate(errp, local_err);
return;
}
--
2.20.1
- [Qemu-block] [PULL 05/27] block: Replace qdict_put() by qdict_put_obj() where appropriate, (continued)
- [Qemu-block] [PULL 05/27] block: Replace qdict_put() by qdict_put_obj() where appropriate, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 01/27] mirror: Release the dirty bitmap if mirror_start_job() fails, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 12/27] vmdk: Reject excess extents in blockdev-create, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 20/27] scsi-disk: Acquire the AioContext in scsi_*_realize(), Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 17/27] block: Remove blk_attach_dev_legacy() / legacy_dev code, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 11/27] iotests: Add VMDK tests for blockdev-create, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 16/27] block: Apply auto-read-only for ro-whitelist drivers, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 10/27] iotests: Filter cid numbers in VMDK extent info, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 13/27] block/vpc: Don't take address of fields in packed structs, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 23/27] iotests/236: fix transaction kwarg order, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 24/27] block: Fix invalidate_cache error path for parent activation,
Kevin Wolf <=
- [Qemu-block] [PULL 03/27] qcow2: Assert that refcount block offsets fit in the refcount table, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 07/27] iotests: Make 234 stable, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 08/27] vmdk: Refactor vmdk_create_extent, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 15/27] uuid: Make qemu_uuid_bswap() take and return a QemuUUID, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 21/27] virtio-scsi: Forbid devices with different iothreads sharing a blockdev, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 09/27] vmdk: Implement .bdrv_co_create callback, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 27/27] scsi-disk: Add device_id property, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 26/27] scsi-disk: Don't use empty string as device id, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 25/27] qtest.py: Wait for the result of qtest commands, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 18/27] block: Eliminate the S_1KiB, S_2KiB, ... macros, Kevin Wolf, 2019/02/01