Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2001 19:15:20 -0400 (EDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Alfred Perlstein <bright@mu.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern vfs_vnops.c
Message-ID:  <Pine.NEB.3.96L.1011023191334.40608B-100000@fledge.watson.org>
In-Reply-To: <20011023170218.Q15052@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 23 Oct 2001, Alfred Perlstein wrote:

> * Robert Watson <rwatson@FreeBSD.org> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1011023191334.40608B-100000>