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