Date: Thu, 7 Aug 2008 12:18:40 -0400 From: John Baldwin <jhb@freebsd.org> To: Robert Watson <rwatson@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org>, Ed Schouten <ed@freebsd.org> Subject: Re: PERFORCE change 146544 for review Message-ID: <200808071218.40578.jhb@freebsd.org> In-Reply-To: <alpine.BSF.1.10.0808031845230.18760@fledge.watson.org> References: <200808031737.m73HbJO8065922@repoman.freebsd.org> <alpine.BSF.1.10.0808031845230.18760@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 03 August 2008 01:46:38 pm Robert Watson wrote: > > On Sun, 3 Aug 2008, Ed Schouten wrote: > > > http://perforce.freebsd.org/chv.cgi?CH=146544 > > > > Change 146544 by ed@ed_flippo on 2008/08/03 17:36:53 > > > > Add a counter to store the number of null modem devices. > > I've seen similar constructs in lots of drivers, and it's basically an unsafe > construct because the deregister is non-atomic with respect to the busy check. > I wonder if, instead, we should use a mutex to protect the count, and set it > to some value to deny future allocations, such as -1, once the ebusy check is > past... Even that is unideal, though. Yes, you basically need to set a flag of some sort to disable cloning, then go tear down the clone handler. And, yes, you probably should just use a mutex for this (there are tricky games one could play with atomic ops, but given how rare clone and detach happen, it isn't worth the code complexity). -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808071218.40578.jhb>