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.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to