[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 87/97] block: Fix invalidate_cache error path for p
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation |
Date: |
Mon, 1 Apr 2019 16:00:01 -0500 |
From: Kevin Wolf <address@hidden>
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>
(cherry picked from commit 78fc3b3a26c145eebcdee992988644974b243a74)
Signed-off-by: Michael Roth <address@hidden>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index a7f6a13a74..50b9bd695d 100644
--- a/block.c
+++ b/block.c
@@ -4395,6 +4395,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.17.1
- [Qemu-stable] [PATCH 46/97] rtl8139: fix possible out of bound access, (continued)
- [Qemu-stable] [PATCH 46/97] rtl8139: fix possible out of bound access, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 05/97] target/arm: Fix typo in helper_sve_ld1hss_r, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 41/97] block/rbd: Attempt to parse legacy filenames, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 55/97] intel_iommu: better handling of dmar state switch, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 93/97] qga: update docs with systemd suspend support info, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 97/97] usb-mtp: use O_NOFOLLOW and O_CLOEXEC., Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 39/97] clean up callback when del virtqueue, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 51/97] block-backend: Set werror/rerror defaults in blk_new(), Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 40/97] block/rbd: pull out qemu_rbd_convert_options, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 24/97] vnc: fix memleak of the "vnc-worker-output" name, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation,
Michael Roth <=
- [Qemu-stable] [PATCH 06/97] target/arm: Fix sign-extension in sve do_ldr/do_str, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 72/97] mirror: fix dead-lock, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 42/97] block/rbd: add iotest for rbd legacy keyvalue filename parsing, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 15/97] target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 90/97] slirp: check sscanf result when emulating ident, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 84/97] tpm: use loop iterator to set sts data field, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 83/97] tpm: Zero-init structure to avoid uninitialized variables in valgrind log, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 44/97] target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 47/97] pcnet: fix possible buffer overflow, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 92/97] bitmap: Update count after a merge, Michael Roth, 2019/04/01