From owner-freebsd-current@FreeBSD.ORG Fri Nov 4 16:36:04 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 829F716A41F; Fri, 4 Nov 2005 16:36:04 +0000 (GMT) (envelope-from keramida@linux.gr) Received: from rosebud.otenet.gr (rosebud.otenet.gr [195.170.0.94]) by mx1.FreeBSD.org (Postfix) with ESMTP id C9F0B43D45; Fri, 4 Nov 2005 16:35:59 +0000 (GMT) (envelope-from keramida@linux.gr) Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) by rosebud.otenet.gr (8.13.4/8.13.4/Debian-1) with SMTP id jA4GZvV2002637; Fri, 4 Nov 2005 18:35:58 +0200 Received: from flame.pc (flame [127.0.0.1]) by flame.pc (8.13.4/8.13.4) with ESMTP id jA4GZnaE088041; Fri, 4 Nov 2005 18:35:49 +0200 (EET) (envelope-from keramida@linux.gr) Received: (from keramida@localhost) by flame.pc (8.13.4/8.13.4/Submit) id jA4GZQMS086109; Fri, 4 Nov 2005 18:35:26 +0200 (EET) (envelope-from keramida@linux.gr) Date: Fri, 4 Nov 2005 18:35:26 +0200 From: Giorgos Keramidas To: Andre Oppermann Message-ID: <20051104163526.GC82727@flame.pc> References: <20051104092724.GA33945@xor.obsecurity.org> <436B70FA.3080401@freebsd.org> <436B885B.6010609@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <436B885B.6010609@freebsd.org> Cc: glebius@freebsd.org, current@freebsd.org, Kris Kennaway Subject: Re: panic: mb_dtor_pack: ref_cnt != 1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2005 16:36:04 -0000 On 2005-11-04 17:12, Andre Oppermann wrote: > Ok, thanks to Danny Braniss and Peter Holm the KASSERT is working now. Very fast fix. Thanks. I barely had the time to build a kernel and read Peter's warning about a broken build, before the fix was ready :) > Index: kern/uipc_mbuf.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/uipc_mbuf.c,v > retrieving revision 1.156 > diff -u -p -r1.156 uipc_mbuf.c > --- kern/uipc_mbuf.c 2 Nov 2005 16:20:35 -0000 1.156 > +++ kern/uipc_mbuf.c 4 Nov 2005 16:09:07 -0000 > @@ -215,9 +215,11 @@ mb_free_ext(struct mbuf *m) > > /* Free attached storage if this mbuf is the only reference to it. > */ > if (*(m->m_ext.ref_cnt) == 1 || > - atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { > + atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { > switch (m->m_ext.ext_type) { > - case EXT_CLUSTER: > + case EXT_CLUSTER: /* The packet zone is special. */ > + if (*(m->m_ext.ref_cnt) == 0) > + *(m->m_ext.ref_cnt) = 1; > uma_zfree(zone_pack, m); > return; /* Job done. */ > break; > Index: kern/kern_mbuf.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/kern_mbuf.c,v > retrieving revision 1.12 > diff -u -p -r1.12 kern_mbuf.c > --- kern/kern_mbuf.c 2 Nov 2005 16:20:35 -0000 1.12 > +++ kern/kern_mbuf.c 4 Nov 2005 16:09:07 -0000 > @@ -395,11 +395,10 @@ mb_ctor_clust(void *mem, int size, void > static void > mb_dtor_clust(void *mem, int size, void *arg) > { > - u_int *refcnt; > > - refcnt = uma_find_refcnt(zone_clust, mem); > - KASSERT(*refcnt == 1, ("%s: refcnt incorrect %u", __func__, > *refcnt)); > - *refcnt = 0; > + KASSERT(*(uma_find_refcnt(zone_clust, mem)) <= 1, > + ("%s: refcnt incorrect %u", __func__, > + *(uma_find_refcnt(zone_clust, mem))) ); > #ifdef INVARIANTS > trash_dtor(mem, size, arg); > #endif > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"