提交 7f8ac4bb 编写于 作者: J John Ferlan

test: Need to relock afer virDomainObjListRemove

For all @dom's fetched from a testDomObjFromDomain because
virDomainObjListRemove will return an unlocked domain object
we should relock it prior to the cleanup label which will use
virDomainObjEndAPI which would Unlock and Unref the passed
object (and we should avoid unlocking an unlocked object).
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
上级 9c75425a
......@@ -1806,8 +1806,10 @@ static int testDomainDestroyFlags(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!privdom->persistent)
if (!privdom->persistent) {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
ret = 0;
cleanup:
......@@ -1905,8 +1907,10 @@ static int testDomainShutdownFlags(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent)
if (!privdom->persistent) {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
ret = 0;
cleanup:
......@@ -1975,8 +1979,10 @@ static int testDomainReboot(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent)
if (!privdom->persistent) {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
}
ret = 0;
......@@ -2114,8 +2120,10 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SAVED);
if (!privdom->persistent)
if (!privdom->persistent) {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
ret = 0;
cleanup:
......@@ -2300,8 +2308,10 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
event = virDomainEventLifecycleNewFromObj(privdom,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
if (!privdom->persistent)
if (!privdom->persistent) {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
}
ret = 0;
......@@ -3080,10 +3090,12 @@ static int testDomainUndefineFlags(virDomainPtr domain,
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
privdom->hasManagedSave = false;
if (virDomainObjIsActive(privdom))
if (virDomainObjIsActive(privdom)) {
privdom->persistent = 0;
else
} else {
virDomainObjListRemove(privconn->domains, privdom);
virObjectLock(privdom);
}
ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册