nwfilter: Rename __virNWFilterInstantiateFilter

Rename to virNWFilterInstantiateFilterUpdate and alter the callers to not
have one parameter per line.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-05-30 15:30:42 -04:00
parent fabbbfe202
commit 3a6e9a2950

View File

@ -58,13 +58,13 @@ static virNWFilterTechDriverPtr filter_tech_drivers[] = {
}; };
/* Serializes instantiation of filters. This is necessary /* Serializes instantiation of filters. This is necessary
* to avoid lock ordering deadlocks. eg __virNWFilterInstantiateFilter * to avoid lock ordering deadlocks. eg virNWFilterInstantiateFilterUpdate
* will hold a lock on a virNWFilterObjPtr. This in turn invokes * will hold a lock on a virNWFilterObjPtr. This in turn invokes
* virNWFilterDoInstantiate which invokes virNWFilterDetermineMissingVarsRec * virNWFilterDoInstantiate which invokes virNWFilterDetermineMissingVarsRec
* which invokes virNWFilterObjListFindByName. This iterates over every single * which invokes virNWFilterObjListFindByName. This iterates over every single
* virNWFilterObjPtr in the list. So if 2 threads try to instantiate a * virNWFilterObjPtr in the list. So if 2 threads try to instantiate a
* filter in parallel, they'll both hold 1 lock at the top level in * filter in parallel, they'll both hold 1 lock at the top level in
* __virNWFilterInstantiateFilter which will cause the other thread * virNWFilterInstantiateFilterUpdate which will cause the other thread
* to deadlock in virNWFilterObjListFindByName. * to deadlock in virNWFilterObjListFindByName.
* *
* XXX better long term solution is to make virNWFilterObjList use a * XXX better long term solution is to make virNWFilterObjList use a
@ -777,18 +777,18 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
* Call this function while holding the NWFilter filter update lock * Call this function while holding the NWFilter filter update lock
*/ */
static int static int
__virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver, virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
const unsigned char *vmuuid, const unsigned char *vmuuid,
bool teardownOld, bool teardownOld,
const char *ifname, const char *ifname,
int ifindex, int ifindex,
const char *linkdev, const char *linkdev,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const char *filtername, const char *filtername,
virNWFilterHashTablePtr filterparams, virNWFilterHashTablePtr filterparams,
enum instCase useNewFilter, enum instCase useNewFilter,
bool forceWithPendingReq, bool forceWithPendingReq,
bool *foundNewFilter) bool *foundNewFilter)
{ {
int rc; int rc;
const char *drvname = EBIPTABLES_DRIVER_ID; const char *drvname = EBIPTABLES_DRIVER_ID;
@ -918,18 +918,11 @@ _virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
goto cleanup; goto cleanup;
} }
rc = __virNWFilterInstantiateFilter(driver, rc = virNWFilterInstantiateFilterUpdate(driver, vmuuid, teardownOld,
vmuuid, net->ifname, ifindex, linkdev,
teardownOld, &net->mac, net->filter,
net->ifname, net->filterparams, useNewFilter,
ifindex, false, foundNewFilter);
linkdev,
&net->mac,
net->filter,
net->filterparams,
useNewFilter,
false,
foundNewFilter);
cleanup: cleanup:
virMutexUnlock(&updateMutex); virMutexUnlock(&updateMutex);
@ -954,18 +947,11 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
virNWFilterReadLockFilterUpdates(); virNWFilterReadLockFilterUpdates();
virMutexLock(&updateMutex); virMutexLock(&updateMutex);
rc = __virNWFilterInstantiateFilter(driver, rc = virNWFilterInstantiateFilterUpdate(driver, vmuuid, true,
vmuuid, ifname, ifindex, linkdev,
true, macaddr, filtername, filterparams,
ifname, INSTANTIATE_ALWAYS, true,
ifindex, &foundNewFilter);
linkdev,
macaddr,
filtername,
filterparams,
INSTANTIATE_ALWAYS,
true,
&foundNewFilter);
if (rc < 0) { if (rc < 0) {
/* something went wrong... 'DOWN' the interface */ /* something went wrong... 'DOWN' the interface */
if ((virNetDevValidateConfig(ifname, NULL, ifindex) <= 0) || if ((virNetDevValidateConfig(ifname, NULL, ifindex) <= 0) ||