mirror of https://gitee.com/openkylin/qemu.git
block/copy-on-read: Fix permissions for inactive node
The copy-on-read drive must not request the WRITE_UNCHANGED permission for its child if the node is inactive, otherwise starting a migration destination with -incoming will fail because the child cannot provide write access yet: qemu-system-x86_64: -blockdev copy-on-read,file=img,node-name=cor: Block node is read-only Earlier QEMU versions additionally ran into an abort() on the migration source side: bdrv_inactivate_recurse() failed to update permissions. This is silently ignored today because it was only supposed to loosen restrictions. This is the symptom that was originally reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1733022 Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
251071e0c0
commit
2b23f28639
|
@ -56,16 +56,14 @@ static void cor_child_perm(BlockDriverState *bs, BdrvChild *c,
|
||||||
uint64_t perm, uint64_t shared,
|
uint64_t perm, uint64_t shared,
|
||||||
uint64_t *nperm, uint64_t *nshared)
|
uint64_t *nperm, uint64_t *nshared)
|
||||||
{
|
{
|
||||||
if (c == NULL) {
|
*nperm = perm & PERM_PASSTHROUGH;
|
||||||
*nperm = (perm & PERM_PASSTHROUGH) | BLK_PERM_WRITE_UNCHANGED;
|
*nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED;
|
||||||
*nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*nperm = (perm & PERM_PASSTHROUGH) |
|
/* We must not request write permissions for an inactive node, the child
|
||||||
(c->perm & PERM_UNCHANGED);
|
* cannot provide it. */
|
||||||
*nshared = (shared & PERM_PASSTHROUGH) |
|
if (!(bs->open_flags & BDRV_O_INACTIVE)) {
|
||||||
(c->shared_perm & PERM_UNCHANGED);
|
*nperm |= BLK_PERM_WRITE_UNCHANGED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue