From owner-cvs-all Tue Oct 23 16:15:33 2001 Delivered-To: cvs-all@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 1000C37B401; Tue, 23 Oct 2001 16:15:26 -0700 (PDT) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f9NNFKB41401; Tue, 23 Oct 2001 19:15:20 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Tue, 23 Oct 2001 19:15:20 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Alfred Perlstein Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern vfs_vnops.c In-Reply-To: <20011023170218.Q15052@elvis.mu.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 23 Oct 2001, Alfred Perlstein wrote: > * Robert Watson [011023 14:09] wrote: > > rwatson 2001/10/23 12:09:01 PDT > >=20 > > Modified files: > > sys/kern vfs_vnops.c=20 > > Log: > > o vn_open() fails to call VOP_CLOSE() if vfs_object_create fails. Id= eally > > all successful calls to VOP_OPEN() might be reflected in a call to > > VOP_CLOSE(). For now, simply add a comment reflecting this problem= ; > > this should be fixed at some point. >=20 > Actually, this looks like an honest to goodness fixable bug. That was my initial prognosis, but I don't have much VM clue, and also don't know much about situations when this might occur. > If vfs_object_create() fails, then vn_open() will return an error > indicating that the open failed, the caller will not know to call > VOP_CLOSE(). From the manpage for VOP_CLOSE:=20 >=20 > =20 > VOP_CLOSE(9) expects at least a reference to be associated with the = vnode > and does not care whether the vnode is locked or not. The lock and = ref=AD > erence state is left unchanged on return.=09Note that vn_close expec= ts an > unlocked, referenced vnode and will dereference the vnode prior to > returning. >=20 > Have you tried to simulate a failure from vfs_objectcreate to see if > vn_open() can be sucessfully fixed? Nope. I suspect that simply stuffing an: =09error2 =3D VOP_CLOSE(vp, dammit); And discarding the results of VOP_CLOSE() is the right solution -- best effort close. > The manpage seems to indicate that all VOP_OPEN calls need VOP_CLOSE, in > fact if I were an underlying filesystem I would be somewhat upset to see > that sort of discrepenacy.=20 Yeah, that was my concern. Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message