svn commit: r246614 - head/sys/dev/usb/wlan

John Baldwin jhb at freebsd.org
Wed Feb 13 20:04:25 UTC 2013


On Wednesday, February 13, 2013 11:04:58 am Hans Petter Selasky wrote:
> Hi,
> 
> On Wednesday 13 February 2013 16:53:02 John Baldwin wrote:
> > You shouldn't call routines that can drain like if_detach() or
> > destroy_dev()  or the like while holding any mutexes period.  I think you
> > need a 0) step which is "detach external consumers" including cdev's
> > (destroy_dev()) and ifnet's (if_detach).  Once both of those routines have
> > finished, you can then proceed with actually stopping device operation,
> > and 2) is not needed as it can't happen once 0) has finished.
> > 
> 
> Right.
> 
> > When a device has both an ifnet and a cdev you may need something to
> > handle  the case of one part being dead but not the other.  For now you
> > can call if_detach() first as it doesn't sleep (though that is a
> > bug).  The real fix for this case (and things like tun(4) can need this as
> > well) is to have a way to call just the non-blocking parts of things like
> > if_detach() and destroy_dev() first to mark the relevant portions as dead
> > and then follow those with blocking calls that do the drain.  This is all
> > part of step 0 though.
> 
> I feel this is out of my area. Can you push the right people to make such a 
> change in the IFNET code and I can update the USB part.

For now because if_detach() is broken I think you can just call 
ether_ifdetach() and then destroy_dev().

-- 
John Baldwin


More information about the svn-src-head mailing list