From owner-freebsd-net@FreeBSD.ORG Tue Aug 29 14:19:11 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BFCC16A4DA; Tue, 29 Aug 2006 14:19:11 +0000 (UTC) (envelope-from rrs@cisco.com) Received: from sj-iport-2.cisco.com (sj-iport-2-in.cisco.com [171.71.176.71]) by mx1.FreeBSD.org (Postfix) with ESMTP id 273AB43D67; Tue, 29 Aug 2006 14:18:57 +0000 (GMT) (envelope-from rrs@cisco.com) Received: from sj-dkim-3.cisco.com ([171.71.179.195]) by sj-iport-2.cisco.com with ESMTP; 29 Aug 2006 07:18:58 -0700 X-IronPort-AV: i="4.08,181,1154934000"; d="scan'208"; a="338687627:sNHT32084516" Received: from sj-core-2.cisco.com (sj-core-2.cisco.com [171.71.177.254]) by sj-dkim-3.cisco.com (8.12.11.20060308/8.12.11) with ESMTP id k7TEIvu4029418; Tue, 29 Aug 2006 07:18:57 -0700 Received: from xbh-sjc-221.amer.cisco.com (xbh-sjc-221.cisco.com [128.107.191.63]) by sj-core-2.cisco.com (8.12.10/8.12.6) with ESMTP id k7TEIvYp006033; Tue, 29 Aug 2006 07:18:57 -0700 (PDT) Received: from xfe-sjc-211.amer.cisco.com ([171.70.151.174]) by xbh-sjc-221.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 29 Aug 2006 07:18:57 -0700 Received: from [127.0.0.1] ([171.68.225.134]) by xfe-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 29 Aug 2006 07:18:56 -0700 Message-ID: <44F44CAA.2000203@cisco.com> Date: Tue, 29 Aug 2006 10:18:18 -0400 From: Randall Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John-Mark Gurney References: <44F35A65.3080605@cisco.com> <20060828224452.GK37035@funkthat.com> In-Reply-To: <20060828224452.GK37035@funkthat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Aug 2006 14:18:57.0111 (UTC) FILETIME=[10904E70:01C6CB76] DKIM-Signature: a=rsa-sha1; q=dns; l=1236; t=1156861137; x=1157725137; c=relaxed/simple; s=sjdkim3002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=rrs@cisco.com; z=From:Randall=20Stewart=20 |Subject:Re=3A=20Problem=20with=20uipc_mbuf.c; X=v=3Dcisco.com=3B=20h=3DGX4otkzfuvQkPAK8JGkm7Q3VVZc=3D; b=CwkIQmq13eGywpKUaxr6aOB1gtNjq8lpcU93QXJopt+VUz5w5+plCBesUkd8tRaoo9ZJ0nkU 5AKST6JH9/tVUBnEW4wHBj90gdLZf5s6on/e2HeQmtz13vb+d6jXmmpa; Authentication-Results: sj-dkim-3.cisco.com; header.From=rrs@cisco.com; dkim=pass ( sig from cisco.com verified; ); Cc: freebsd-net@freebsd.org, andre@freebsd.org Subject: Re: Problem with uipc_mbuf.c X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Aug 2006 14:19:11 -0000 John-Mark: Ok, I confirmed it... Changing it to be atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) Fixes the problem.. no more leaks :-D R John-Mark Gurney wrote: > Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: > >> atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { > > ^ > > This should be 1 not 0.. as apparently fetchadd_int returns the old value > (at least that's what atomic(9) says), which means that if we ever race > on this comparision, we won't free though we should of... > > if we look at refcount.h, it does: > return (atomic_fetchadd_int(count, -1) == 1); > > which release a reference and apparently returns true if it needs to > be free'd... > > Though the wierd part is that andre, "fixed" it to be 0 in 1.157: > Fix a logic error introduced with mandatory mbuf cluster refcounting and > freeing of mbufs+clusters back to the packet zone. > > >>I am thinking about restoring the old code.. since >>it appears to work... >> >>Any comments or help would be appreciated.. > > > Lets see what andre has to say about this. > -- Randall Stewart NSSTG - Cisco Systems Inc. 803-345-0369 815-342-5222 (cell)