PERFORCE change 146544 for review
Kostik Belousov
kostikbel at gmail.com
Thu Aug 7 18:43:06 UTC 2008
On Thu, Aug 07, 2008 at 12:18:40PM -0400, John Baldwin wrote:
> 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).
I answered to Ed on the channel, the right incantation sequence is:
1. remove clone eventhandler;
2. call drain_dev_clone_events() to move past the point where new clones
may be created;
3. do the destroy_dev() as needed;
4. if code ever called destroy_dev_sched(), call destroy_dev_drain(&csw).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/p4-projects/attachments/20080807/3f377536/attachment.pgp
More information about the p4-projects
mailing list