From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 13:53:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0164B10656A3; Wed, 26 Sep 2012 13:53:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A98018FC2D; Wed, 26 Sep 2012 13:53:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 06D24B9AD; Wed, 26 Sep 2012 09:53:30 -0400 (EDT) From: John Baldwin To: Ed Maste Date: Wed, 26 Sep 2012 09:38:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926045204.GG35915@deviant.kiev.zoral.com.ua> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201209260938.21301.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 26 Sep 2012 09:53:30 -0400 (EDT) Cc: Konstantin Belousov , 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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 13:53:31 -0000 On Wednesday, September 26, 2012 8:48:03 am Ed Maste wrote: > On 26 September 2012 00:52, Konstantin Belousov wrote: > > On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: > >> Author: emaste > >> Date: Tue Sep 25 22:10:14 2012 > >> New Revision: 240938 > >> URL: http://svn.freebsd.org/changeset/base/240938 > >> > >> Log: > >> Avoid INVARIANTS panic destroying an in-use tap(4) > >> > >> The requirement (implied by the KASSERT in tap_destroy) that the tap is > >> closed isn't valid; destroy_dev will block in devdrn while other threads > >> are in d_* functions. > > Are you sure ? > > > > The device may be opened, but no threads could be in any cdevsw > > methods. destroy_dev(9) only waits for threads to leave cdevsw methods, > > and not for the close to happen. > > My first approach mirrored if_tun, but jhb@ pointed out on IRC that > any open devices will revert to dead_devsw so that future accesses > will fail. You do need to ensure that any resources in use by an open device are cleaned up, but I think devfs will do useful things such as destroy all the cdev_priv objects associated with a device after the "devdrn" sleep finishes, so that the cleanup generally happens "for free". -- John Baldwin