|
|
7711c0 |
From b7d8518d4d2e5d53c2f8eb6cc78d99a69dc4feff Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Date: Mon, 4 Feb 2019 16:06:04 +0100
|
|
|
7711c0 |
Subject: [PATCH 7/8] block: Fix invalidate_cache error path for parent
|
|
|
7711c0 |
activation
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Message-id: <20190204160604.2723-2-kwolf@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84202
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 1/1] block: Fix invalidate_cache error path for parent activation
|
|
|
7711c0 |
Bugzilla: 1531888
|
|
|
7711c0 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
bdrv_co_invalidate_cache() clears the BDRV_O_INACTIVE flag before
|
|
|
7711c0 |
actually activating a node so that the correct permissions etc. are
|
|
|
7711c0 |
taken. In case of errors, the flag must be restored so that the next
|
|
|
7711c0 |
call to bdrv_co_invalidate_cache() retries activation.
|
|
|
7711c0 |
|
|
|
7711c0 |
Restoring the flag was missing in the error path for a failed
|
|
|
7711c0 |
parent->role->activate() call. The consequence is that this attempt to
|
|
|
7711c0 |
activate all images correctly fails because we still set errp, however
|
|
|
7711c0 |
on the next attempt BDRV_O_INACTIVE is already clear, so we return
|
|
|
7711c0 |
success without actually retrying the failed action.
|
|
|
7711c0 |
|
|
|
7711c0 |
An example where this is observable in practice is migration to a QEMU
|
|
|
7711c0 |
instance that has a raw format block node attached to a guest device
|
|
|
7711c0 |
with share-rw=off (the default) while another process holds
|
|
|
7711c0 |
BLK_PERM_WRITE for the same image. In this case, all activation steps
|
|
|
7711c0 |
before parent->role->activate() succeed because raw can tolerate other
|
|
|
7711c0 |
writers to the image. Only the parent callback (in particular
|
|
|
7711c0 |
blk_root_activate()) tries to implement the share-rw=on property and
|
|
|
7711c0 |
requests exclusive write permissions. This fails when the migration
|
|
|
7711c0 |
completes and correctly displays an error. However, a manual 'cont' will
|
|
|
7711c0 |
incorrectly resume the VM without calling blk_root_activate() again.
|
|
|
7711c0 |
|
|
|
7711c0 |
This case is described in more detail in the following bug report:
|
|
|
7711c0 |
https://bugzilla.redhat.com/show_bug.cgi?id=1531888
|
|
|
7711c0 |
|
|
|
7711c0 |
Fix this by correctly restoring the BDRV_O_INACTIVE flag in the error
|
|
|
7711c0 |
path.
|
|
|
7711c0 |
|
|
|
7711c0 |
Cc: qemu-stable@nongnu.org
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Tested-by: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 78fc3b3a26c145eebcdee992988644974b243a74)
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
block.c | 1 +
|
|
|
7711c0 |
1 file changed, 1 insertion(+)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/block.c b/block.c
|
|
|
7711c0 |
index da9b1a6..ce85c65 100644
|
|
|
7711c0 |
--- a/block.c
|
|
|
7711c0 |
+++ b/block.c
|
|
|
7711c0 |
@@ -4410,6 +4410,7 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
|
|
|
7711c0 |
if (parent->role->activate) {
|
|
|
7711c0 |
parent->role->activate(parent, &local_err);
|
|
|
7711c0 |
if (local_err) {
|
|
|
7711c0 |
+ bs->open_flags |= BDRV_O_INACTIVE;
|
|
|
7711c0 |
error_propagate(errp, local_err);
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|