From owner-p4-projects@FreeBSD.ORG Fri Sep 5 09:11:19 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9784716A4E0; Fri, 5 Sep 2003 09:11:18 -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 3D22716A4F5 for ; Fri, 5 Sep 2003 09:11:18 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A390243F3F for ; Fri, 5 Sep 2003 09:11:17 -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 h85GBH0U040196 for ; Fri, 5 Sep 2003 09:11:17 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h85GBHDd040193 for perforce@freebsd.org; Fri, 5 Sep 2003 09:11:17 -0700 (PDT) Date: Fri, 5 Sep 2003 09:11:17 -0700 (PDT) Message-Id: <200309051611.h85GBHDd040193@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 37575 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: Fri, 05 Sep 2003 16:11:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=37575 Change 37575 by sam@sam_ebb on 2003/09/05 09:10:33 Locking fixups based on testing by Pavlin Radoslavov . Move up VIF_LOCK in add_mfc to insure lock order for ip_mdq. ip_mdq handling of bw_meter_receive_packet does not require an explicit MFC lock; use an existing lock. Affected files ... .. //depot/projects/netperf/sys/netinet/ip_mroute.c#9 edit Differences ... ==== //depot/projects/netperf/sys/netinet/ip_mroute.c#9 (text+ko) ==== @@ -1116,6 +1116,7 @@ u_short nstl; int s; + VIF_LOCK(); MFC_LOCK(); rt = mfc_find(mfccp->mfcc_origin.s_addr, mfccp->mfcc_mcastgrp.s_addr); @@ -1130,6 +1131,7 @@ update_mfc_params(rt, mfccp); MFC_UNLOCK(); + VIF_UNLOCK(); return 0; } @@ -1212,6 +1214,7 @@ } } MFC_UNLOCK(); + VIF_UNLOCK(); return 0; } @@ -1331,6 +1334,7 @@ } VIF_LOCK(); + MFC_LOCK(); if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) { if (ip->ip_ttl < 255) ip->ip_ttl++; /* compensate for -1 in *_send routines */ @@ -1344,6 +1348,7 @@ vifp->v_ifp->if_name, vifp->v_ifp->if_unit); } error = ip_mdq(m, ifp, NULL, vifi); + MFC_UNLOCK(); VIF_UNLOCK(); return error; } @@ -1359,6 +1364,7 @@ * or a packet destined to a local-only group. */ if (ip->ip_ttl <= 1 || ntohl(ip->ip_dst.s_addr) <= INADDR_MAX_LOCAL_GROUP) { + MFC_UNLOCK(); VIF_UNLOCK(); return 0; } @@ -1366,14 +1372,13 @@ /* * Determine forwarding vifs from the forwarding cache table */ - MFC_LOCK(); ++mrtstat.mrts_mfc_lookups; rt = mfc_find(ip->ip_src.s_addr, ip->ip_dst.s_addr); /* Entry exists, so forward if necessary */ if (rt != NULL) { + error = ip_mdq(m, ifp, rt, -1); MFC_UNLOCK(); - error = ip_mdq(m, ifp, rt, -1); VIF_UNLOCK(); return error; } else { @@ -1744,10 +1749,9 @@ struct timeval now; GET_TIME(now); - MFC_LOCK(); + MFC_LOCK_ASSERT(); for (x = rt->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) bw_meter_receive_packet(x, plen, &now); - MFC_UNLOCK(); } return 0;