PERFORCE change 146544 for review
John Baldwin
jhb at freebsd.org
Thu Aug 7 16:44:57 UTC 2008
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 at 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
More information about the p4-projects
mailing list