From owner-svn-src-head@FreeBSD.ORG Tue Nov 29 09:35:52 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B78BA1065673; Tue, 29 Nov 2011 09:35:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 2204B8FC13; Tue, 29 Nov 2011 09:35:51 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pAT9ZpsR074498; Tue, 29 Nov 2011 13:35:51 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pAT9ZoJs074497; Tue, 29 Nov 2011 13:35:50 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 29 Nov 2011 13:35:50 +0400 From: Gleb Smirnoff To: "Bjoern A. Zeeb" Message-ID: <20111129093550.GZ44498@FreeBSD.org> References: <201111281444.pASEixdO095604@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228071 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2011 09:35:52 -0000 On Mon, Nov 28, 2011 at 07:47:22PM +0000, Bjoern A. Zeeb wrote: B> On 28. Nov 2011, at 14:44 , Gleb Smirnoff wrote: B> B> > Author: glebius B> > Date: Mon Nov 28 14:44:59 2011 B> > New Revision: 228071 B> > URL: http://svn.freebsd.org/changeset/base/228071 B> > B> > Log: B> > - Use generic alloc_unr(9) allocator for if_clone, instead B> > of hand-made. B> > - When registering new cloner, check whether a cloner with B> > same name already exist. B> > - When allocating unit, also check with help of ifunit() B> > whether such interface already exist or not. [1] B> B> This forces packages to be recompiled; they might like to have a __FreeBSD_version for that? B> It's not MFCable, at least I think - don't see a MFC after, just want to be sure. No plans for MFC. btw, I don't like the static initializer of cloners, since it require re-compile of dependencies. What about making an API change: remove the static initializer and make an initializer function. Modules should have only a pointer to opaque structure. We will bump __FreeBSD_version for that. But later with any change to the if_clone struct, we won't have ABI change. If everyone agrees, I can go for that. B> See one more comment inline? B> > + ifc->ifc_unrhdr = new_unrhdr(0, ifc->ifc_maxunit, &ifc->ifc_mtx); B> > + LIST_INIT(&ifc->ifc_iflist); B> > B> > IF_CLONERS_LOCK(); B> > + LIST_FOREACH(ifc1, &V_if_cloners, ifc_list) B> > + if (strcmp(ifc->ifc_name, ifc1->ifc_name) == 0) { B> > + IF_CLONERS_UNLOCK(); B> > + IF_CLONE_REMREF(ifc); B> > + return (EEXIST); B> B> At this point you may have a problem not freeing the unr? No, there is no problem. The code path that goes to delete_unrhdr() is the following: IF_CLONE_REMREF calls IF_CLONE_REMREF_LOCKED, the latter calls if_clone_free(), and the last one calls delete_unrhdr(). -- Totus tuus, Glebius.