提交 47d610e9 编写于 作者: P Peter Krempa

qemu: blockcopy: sanitize permission handling for 'mirror'

At the point when we want to modify the permissions for the 'mirror' we
know whether it is supposed to have a backing chain or no. Given that
mirror->backingStore is populated only when we'd need to touch it ayways
we can use qemuDomainStorageSourceChainAccessAllow even in place of
qemuDomainStorageSourceAccessAllow used for other cases to simplify the
code.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 32ec5fee
......@@ -17773,17 +17773,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuDomainDetermineDiskChain(driver, vm, disk, mirror, true) < 0)
goto endjob;
if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT &&
virStorageSourceHasBacking(mirror)) {
/* note that we don't really know whether a part of the backing chain
* is shared so rolling this back is not as easy. Thus we do it only
* if there's a backing chain */
if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0)
goto endjob;
} else {
if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, true) < 0)
goto endjob;
}
if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0)
goto endjob;
if (!(job = qemuBlockJobDiskNew(disk, QEMU_BLOCKJOB_TYPE_COPY, device)))
goto endjob;
......@@ -17800,7 +17791,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
if (ret < 0) {
qemuDomainStorageSourceAccessRevoke(driver, vm, mirror);
qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror);
goto endjob;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册