From owner-freebsd-current@FreeBSD.ORG Fri May 16 09:46:05 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 F262B37B401 for ; Fri, 16 May 2003 09:46:04 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F13C43FAF for ; Fri, 16 May 2003 09:46:04 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9/8.12.9) with ESMTP id h4GGjuM7058624; Fri, 16 May 2003 09:46:00 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200305161646.h4GGjuM7058624@gw.catspoiler.org> Date: Fri, 16 May 2003 09:45:56 -0700 (PDT) From: Don Lewis To: bde@zeta.org.au In-Reply-To: <20030516233858.U12541@gamplex.bde.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: Fri, 16 May 2003 16:46:05 -0000 On 16 May, Bruce Evans wrote: > On Fri, 16 May 2003, Don Lewis wrote: > >> There are a few problems in the fifo_open() and fifo_close() >> implementations. >> ... >> This patch makes the following changes: >> >> Create fifo_inactive() and free the fifo data structures there >> instead of in fifo_close() to eliminate the need for fifo_open() >> call fifo_close() in some of the failure cases. This also >> eliminates the need for the vrefcnt() call in fifo_close(). >> >> Protect fip->fi_{readers,writers} with the vnode interlock in both >> fifo_open() and fifo_close(). >> >> Convert from tsleep() to msleep() using the vnode interlock to >> eliminate the race condition. > > Why not just lock the vnode in fifo_close()? RELENG[2-4] seems to have > the same bug. I cannot be fixed there using the vnode interlock. That is probably the proper fix for RELENG4 where finer-grained locking isn't needed because of Giant. I'd still probably move the resource deallocation to fifo_inactive().