From owner-p4-projects@FreeBSD.ORG Thu Aug 7 16:44:56 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BD7041065675; Thu, 7 Aug 2008 16:44:56 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E3971065671; Thu, 7 Aug 2008 16:44:56 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1A7BD8FC0C; Thu, 7 Aug 2008 16:44:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m77GiioH017978; Thu, 7 Aug 2008 12:44:49 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Robert Watson Date: Thu, 7 Aug 2008 12:18:40 -0400 User-Agent: KMail/1.9.7 References: <200808031737.m73HbJO8065922@repoman.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808071218.40578.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Thu, 07 Aug 2008 12:44:50 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/7972/Thu Aug 7 08:22:20 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Perforce Change Reviews , Ed Schouten Subject: Re: PERFORCE change 146544 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2008 16:44:57 -0000 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