mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
nwfilter: reorder locks
This patch reorders the locks for the nwfilter updates and the access the nwfilter objects. In the case that the IP address learning thread was instantiating filters while an update happened, the previous order lead to a deadlock.
This commit is contained in:
parent
ecbe86c0c5
commit
8cc166e76e
@ -2394,15 +2394,13 @@ virNWFilterTestUnassignDef(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
virNWFilterLockFilterUpdates();
|
|
||||||
|
|
||||||
nwfilter->wantRemoved = 1;
|
nwfilter->wantRemoved = 1;
|
||||||
/* trigger the update on VMs referencing the filter */
|
/* trigger the update on VMs referencing the filter */
|
||||||
if (virNWFilterTriggerVMFilterRebuild(conn))
|
if (virNWFilterTriggerVMFilterRebuild(conn))
|
||||||
rc = 1;
|
rc = 1;
|
||||||
|
|
||||||
nwfilter->wantRemoved = 0;
|
nwfilter->wantRemoved = 0;
|
||||||
virNWFilterUnlockFilterUpdates();
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2434,8 +2432,9 @@ virNWFilterObjAssignDef(virConnectPtr conn,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((nwfilter = virNWFilterObjFindByName(nwfilters, def->name))) {
|
|
||||||
virNWFilterLockFilterUpdates();
|
virNWFilterLockFilterUpdates();
|
||||||
|
|
||||||
|
if ((nwfilter = virNWFilterObjFindByName(nwfilters, def->name))) {
|
||||||
nwfilter->newDef = def;
|
nwfilter->newDef = def;
|
||||||
/* trigger the update on VMs referencing the filter */
|
/* trigger the update on VMs referencing the filter */
|
||||||
if (virNWFilterTriggerVMFilterRebuild(conn)) {
|
if (virNWFilterTriggerVMFilterRebuild(conn)) {
|
||||||
@ -2452,6 +2451,8 @@ virNWFilterObjAssignDef(virConnectPtr conn,
|
|||||||
return nwfilter;
|
return nwfilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virNWFilterUnlockFilterUpdates();
|
||||||
|
|
||||||
if (VIR_ALLOC(nwfilter) < 0) {
|
if (VIR_ALLOC(nwfilter) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -372,6 +372,8 @@ nwfilterUndefine(virNWFilterPtr obj) {
|
|||||||
nwfilterDriverLock(driver);
|
nwfilterDriverLock(driver);
|
||||||
virNWFilterCallbackDriversLock();
|
virNWFilterCallbackDriversLock();
|
||||||
|
|
||||||
|
virNWFilterLockFilterUpdates();
|
||||||
|
|
||||||
nwfilter = virNWFilterObjFindByUUID(&driver->nwfilters, obj->uuid);
|
nwfilter = virNWFilterObjFindByUUID(&driver->nwfilters, obj->uuid);
|
||||||
if (!nwfilter) {
|
if (!nwfilter) {
|
||||||
virNWFilterReportError(VIR_ERR_NO_NWFILTER,
|
virNWFilterReportError(VIR_ERR_NO_NWFILTER,
|
||||||
@ -399,6 +401,8 @@ cleanup:
|
|||||||
if (nwfilter)
|
if (nwfilter)
|
||||||
virNWFilterObjUnlock(nwfilter);
|
virNWFilterObjUnlock(nwfilter);
|
||||||
|
|
||||||
|
virNWFilterUnlockFilterUpdates();
|
||||||
|
|
||||||
virNWFilterCallbackDriversUnlock();
|
virNWFilterCallbackDriversUnlock();
|
||||||
nwfilterDriverUnlock(driver);
|
nwfilterDriverUnlock(driver);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user