PERFORCE change 37649 for review
Sam Leffler
sam at FreeBSD.org
Fri Sep 5 21:22:59 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=37649
Change 37649 by sam at sam_ebb on 2003/09/05 21:21:59
more locking fixups from Pavlin Radoslavov <pavlin at icir.org>
Affected files ...
.. //depot/projects/netperf/sys/netinet/ip_mroute.c#10 edit
Differences ...
==== //depot/projects/netperf/sys/netinet/ip_mroute.c#10 (text+ko) ====
@@ -549,14 +549,15 @@
MFC_LOCK();
rt = mfc_find(req->src.s_addr, req->grp.s_addr);
- MFC_UNLOCK();
if (rt == NULL) {
+ MFC_UNLOCK();
req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff;
return EADDRNOTAVAIL;
}
req->pktcnt = rt->mfc_pkt_cnt;
req->bytecnt = rt->mfc_byte_cnt;
req->wrong_if = rt->mfc_wrong_if;
+ MFC_UNLOCK();
return 0;
}
@@ -568,13 +569,17 @@
{
vifi_t vifi = req->vifi;
- if (vifi >= numvifs)
+ VIF_LOCK();
+ if (vifi >= numvifs) {
+ VIF_UNLOCK();
return EINVAL;
+ }
req->icount = viftable[vifi].v_pkt_in;
req->ocount = viftable[vifi].v_pkt_out;
req->ibytes = viftable[vifi].v_bytes_in;
req->obytes = viftable[vifi].v_bytes_out;
+ VIF_UNLOCK();
return 0;
}
@@ -894,8 +899,10 @@
{
sin.sin_addr = vifcp->vifc_lcl_addr;
ifa = ifa_ifwithaddr((struct sockaddr *)&sin);
- if (ifa == NULL)
+ if (ifa == NULL) {
+ VIF_UNLOCK();
return EADDRNOTAVAIL;
+ }
ifp = ifa->ifa_ifp;
}
@@ -1114,7 +1121,6 @@
u_long hash;
struct rtdetq *rte;
u_short nstl;
- int s;
VIF_LOCK();
MFC_LOCK();
@@ -1199,7 +1205,8 @@
if (rt == NULL) { /* no upcall, so make a new entry */
rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
- splx(s);
+ MFC_UNLOCK();
+ VIF_UNLOCK();
return ENOBUFS;
}
@@ -1253,8 +1260,6 @@
*nptr = rt->mfc_next;
- MFC_UNLOCK();
-
/*
* free the bw_meter entries
*/
@@ -1265,6 +1270,8 @@
free_bw_list(list);
+ MFC_UNLOCK();
+
return 0;
}
@@ -2439,8 +2446,8 @@
list = mfc->mfc_bw_meter;
mfc->mfc_bw_meter = NULL;
+ free_bw_list(list);
MFC_UNLOCK();
- free_bw_list(list);
return 0;
} else { /* Delete a single bw_meter entry */
struct bw_meter *prev;
@@ -2463,9 +2470,9 @@
prev->bm_mfc_next = x->bm_mfc_next; /* remove from middle*/
else
x->bm_mfc->mfc_bw_meter = x->bm_mfc_next;/* new head of list */
- MFC_UNLOCK();
unschedule_bw_meter(x);
+ MFC_UNLOCK();
/* Free the bw_meter entry */
free(x, M_BWMETER);
return 0;
More information about the p4-projects
mailing list