From owner-freebsd-current@FreeBSD.ORG Sat May 17 02:41:20 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 950CA37B401; Sat, 17 May 2003 02:41:20 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F4BE43FB1; Sat, 17 May 2003 02:41:19 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id TAA30780; Sat, 17 May 2003 19:41:16 +1000 Date: Sat, 17 May 2003 19:41:15 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Don Lewis In-Reply-To: <200305170740.h4H7e2M7059876@gw.catspoiler.org> Message-ID: <20030517190409.Q15481@gamplex.bde.org> References: <200305170740.h4H7e2M7059876@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@FreeBSD.org Subject: Re: CFR: fifo_open()/fifo_close() patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 May 2003 09:41:20 -0000 On Sat, 17 May 2003, Don Lewis wrote: > On 17 May, Bruce Evans wrote: > > My question is mainly: why do you want or need the extra complexity for > > using the vnode interlock here? > > I want to use the vnode interlock so that I can msleep() on it to avoid > a race condition. If I rely on the vnode lock to protect fi_readers and > fi_writers, another thread could sneak in, update them, and call > wakeup() between the VOP_UNLOCK() call and the tsleep() call, causing > the thread calling tsleep() to miss the wakeup(). I see. I now think fifo_close() needs both the vnode lock and the interlock. Its socantrcvmore() calls should be atomic with decrementing the reader/writer counts to 0. I think locking them with the interlock would work, but this depends too much on their internals (not sleeping). Sorry, I deleted your original patch and don't remember exactly what it does here. NetBSD changed VOP_CLOSE() to "L L L" 4+ years ago. Bruce