From owner-p4-projects@FreeBSD.ORG Fri Sep 5 21:22:59 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 60D1F16A4C1; Fri, 5 Sep 2003 21:22:59 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1BC6216A4BF for ; Fri, 5 Sep 2003 21:22:59 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 800AB43FE1 for ; Fri, 5 Sep 2003 21:22:58 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h864Mw0U098377 for ; Fri, 5 Sep 2003 21:22:58 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h864MwRl098374 for perforce@freebsd.org; Fri, 5 Sep 2003 21:22:58 -0700 (PDT) Date: Fri, 5 Sep 2003 21:22:58 -0700 (PDT) Message-Id: <200309060422.h864MwRl098374@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 37649 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Sep 2003 04:22:59 -0000 http://perforce.freebsd.org/chv.cgi?CH=37649 Change 37649 by sam@sam_ebb on 2003/09/05 21:21:59 more locking fixups from Pavlin Radoslavov 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;