qemu-kvm/kvm-block-Fix-invalidate_cache-error-path-for-parent-act.patch
Danilo C. L. de Paula b705db35b7 * Mon Feb 11 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-13.el8
- kvm-Acceptance-tests-add-Linux-initrd-checking-test.patch [bz#1669922]
- kvm-mmap-alloc-unfold-qemu_ram_mmap.patch [bz#1671519]
- kvm-mmap-alloc-fix-hugetlbfs-misaligned-length-in-ppc64.patch [bz#1671519]
- kvm-BZ1653590-Require-at-least-64kiB-pages-for-downstrea.patch [bz#1653590]
- kvm-block-Fix-invalidate_cache-error-path-for-parent-act.patch [bz#1673014]
- kvm-virtio-scsi-Move-BlockBackend-back-to-the-main-AioCo.patch [bz#1656276 bz#1662508]
- kvm-scsi-disk-Acquire-the-AioContext-in-scsi_-_realize.patch [bz#1656276 bz#1662508]
- kvm-virtio-scsi-Forbid-devices-with-different-iothreads-.patch [bz#1656276 bz#1662508]
- Resolves: bz#1653590
  ([Fast train]had better stop qemu immediately while guest was making use of an improper page size)
- Resolves: bz#1656276
  (qemu-kvm core dumped after hotplug the deleted disk with iothread parameter)
- Resolves: bz#1662508
  (Qemu core dump when start guest with two disks using same drive)
- Resolves: bz#1669922
  (Backport avocado-qemu tests for QEMU 3.1)
- Resolves: bz#1671519
  (RHEL8.0 Snapshot3 - qemu doesn't free up hugepage memory when hotplug/hotunplug using memory-backend-file (qemu-kvm))
- Resolves: bz#1673014
  (Local VM and migrated VM on the same host can run with same RAW file as visual disk source while without shareable configured or lock manager enabled)
2019-02-11 14:09:54 -02:00

70 lines
2.9 KiB
Diff

From d6445c856c6199938eccbd73721c0c8257604557 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 6 Feb 2019 15:13:14 +0000
Subject: [PATCH 5/8] block: Fix invalidate_cache error path for parent
activation
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20190206151314.4789-2-kwolf@redhat.com>
Patchwork-id: 84251
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH 1/1] block: Fix invalidate_cache error path for parent activation
Bugzilla: 1673014
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
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: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 78fc3b3a26c145eebcdee992988644974b243a74)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index 811239c..1ec4512 100644
--- a/block.c
+++ b/block.c
@@ -4553,6 +4553,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;
}
--
1.8.3.1