Subject: Re: panic: lockmgr: release of unlocked lock
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 01/25/2005 16:09:52
--aT9PWwzfKXlsBJM1
Content-Type: multipart/mixed; boundary="i0/AhcQY5QxfSsSZ"
Content-Disposition: inline


--i0/AhcQY5QxfSsSZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 24, 2005 at 09:19:35AM +0900, YAMAMOTO Takashi wrote:
> > > What kind of diagnostic do you have in mind ? I'm sorry, but I don't =
know
> > > this part of the code so I don't know what to check ...
> >=20
> > cnp->cn_flags would be good. Plus the simple fact of the printf happeni=
ng=20
> > would help too. :-)
> >=20
> > Somehow or another a parent directory is getting returned in the wrong=
=20
> > lock state. I'm not sure why...
>=20
> isn't this a known problem?

Maybe. If it is, the following patch should fix things. I printed out=20
lookup() and stared at all the error cases. This fix is the only one I=20
found we need, and we need it strongly. :-)

The only other questionable case I found should be fine with the correct=20
input flags. The case was that the goto terminal just above dirloop: could=
=20
get to bad2 with ni_dvp unset. However we would have to be on a RO fs and=
=20
(more importantly) be performing a DELETE or RENAME op with both=20
LOCKPARENT and WANTPARENT unset. The latter shouldn't happen.

As an aside, it might be interesting to put a diagnostic printf() in the=20
new conditional. If the printf() fires, we know we found the issue.

Take care,

Bill

--i0/AhcQY5QxfSsSZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=lookup_error_fix
Content-Transfer-Encoding: quoted-printable

Index: vfs_lookup.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.55
diff -u -r1.55 vfs_lookup.c
--- vfs_lookup.c	17 Sep 2004 14:11:25 -0000	1.55
+++ vfs_lookup.c	25 Jan 2005 23:57:19 -0000
@@ -528,6 +528,9 @@
 			goto unionlookup;
 		}
=20
+		if (cnp->cn_flags & PDIRUNLOCK)
+			dpunlocked =3D 1;
+
 		if (error !=3D EJUSTRETURN)
 			goto bad;
 		/*

--i0/AhcQY5QxfSsSZ--

--aT9PWwzfKXlsBJM1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFB9t/QWz+3JHUci9cRAuZ2AJkBCyBDeCGWomf9+qLWhpjdhzNf6wCfUWhz
hsTC6Ml5hbClXH39jG4BBKk=
=gYuj
-----END PGP SIGNATURE-----

--aT9PWwzfKXlsBJM1--