Date: Wed, 26 Sep 2012 10:56:15 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Ed Maste <emaste@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r240938 - head/sys/net Message-ID: <20120926065615.GZ50433@FreeBSD.org> In-Reply-To: <201209252210.q8PMAEx5003950@svn.freebsd.org> References: <201209252210.q8PMAEx5003950@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120926065615.GZ50433>