From owner-freebsd-current@FreeBSD.ORG Fri May 16 23:57:17 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 42EEF37B693; Fri, 16 May 2003 23:57:17 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF68943F75; Fri, 16 May 2003 23:57:15 -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 QAA18939; Sat, 17 May 2003 16:57:08 +1000 Date: Sat, 17 May 2003 16:57:06 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Don Lewis In-Reply-To: <200305161646.h4GGjuM7058624@gw.catspoiler.org> Message-ID: <20030517160738.U15076@gamplex.bde.org> References: <200305161646.h4GGjuM7058624@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 06:57:17 -0000 On Fri, 16 May 2003, Don Lewis wrote: > On 16 May, Bruce Evans wrote: > > 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(). RELENG_4 actually can probably be fixed using the vnode interlock. The interlock exists there. It just may require more care because it is a spinlock. My question is mainly: why do you want or need the extra complexity for using the vnode interlock here? Hmm, I see that at least ufs_close() likes to use only the vnode interlock, but this seems to be wrong. From ufs_vnops.c:vop_close(): % VI_LOCK(vp); % if (vp->v_usecount > 1) % ufs_itimes(vp); % VI_UNLOCK(vp); % return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); The interlock protects the v_usecount check here, but AFAIK it doesn't protect ufs_itimes(). ufs_itimes() hacks on the inode's flags and timestamps without acquiring any other locks. I believe it expects to be locked by the vnode lock. This behaviour goes back to Lite1 or before (not much except the names have changed since rev.1.1). Bruce