From owner-svn-src-head@FreeBSD.ORG Wed Sep 26 06:56:22 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 943DC106564A; Wed, 26 Sep 2012 06:56:22 +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 0CB368FC12; Wed, 26 Sep 2012 06:56:21 +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 q8Q6uF31085658; Wed, 26 Sep 2012 10:56:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q8Q6uFmU085657; Wed, 26 Sep 2012 10:56:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 26 Sep 2012 10:56:15 +0400 From: Gleb Smirnoff To: Ed Maste Message-ID: <20120926065615.GZ50433@FreeBSD.org> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201209252210.q8PMAEx5003950@svn.freebsd.org> 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: r240938 - 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: Wed, 26 Sep 2012 06:56:22 -0000 Ed, On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: E> Author: emaste E> Date: Tue Sep 25 22:10:14 2012 E> New Revision: 240938 E> URL: http://svn.freebsd.org/changeset/base/240938 E> E> Log: E> Avoid INVARIANTS panic destroying an in-use tap(4) E> E> The requirement (implied by the KASSERT in tap_destroy) that the tap is E> closed isn't valid; destroy_dev will block in devdrn while other threads E> are in d_* functions. E> E> Note: if_tun had the same issue, addressed in SVN revisions r186391, E> r186483 and r186497. The use of the condvar there appears to be E> redundant with the functionality provided by destroy_dev. So why did you add condvar to the softc? See it in diff below. E> Sponsored by: ADARA Networks E> Reviewed by: dwhite E> MFC after: 2 weeks E> E> Modified: E> head/sys/net/if_tap.c E> head/sys/net/if_tapvar.h E> E> Modified: head/sys/net/if_tap.c E> ============================================================================== E> --- head/sys/net/if_tap.c Tue Sep 25 21:33:36 2012 (r240937) E> +++ head/sys/net/if_tap.c Tue Sep 25 22:10:14 2012 (r240938) E> @@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp) E> { E> struct ifnet *ifp = tp->tap_ifp; E> E> - /* Unlocked read. */ E> - KASSERT(!(tp->tap_flags & TAP_OPEN), E> - ("%s flags is out of sync", ifp->if_xname)); E> - E> CURVNET_SET(ifp->if_vnet); E> + destroy_dev(tp->tap_dev); E> seldrain(&tp->tap_rsel); E> knlist_destroy(&tp->tap_rsel.si_note); E> - destroy_dev(tp->tap_dev); E> ether_ifdetach(ifp); E> if_free(ifp); E> E> E> Modified: head/sys/net/if_tapvar.h E> ============================================================================== E> --- head/sys/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) E> +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) E> @@ -64,6 +64,7 @@ struct tap_softc { E> SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ E> struct cdev *tap_dev; E> struct mtx tap_mtx; /* per-softc mutex */ E> + struct cv tap_cv; /* protect ref'd dev destroy */ E> }; E> E> #endif /* !_NET_IF_TAPVAR_H_ */ -- Totus tuus, Glebius.