Subject: Re: panic: lockmgr: release of unlocked lock
To: YAMAMOTO Takashi <>
From: Bill Studenmund <>
List: tech-kern
Date: 01/25/2005 16:09:52
Content-Type: multipart/mixed; boundary="i0/AhcQY5QxfSsSZ"
Content-Disposition: inline

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 =
> > > 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=
> > would help too. :-)
> >=20
> > Somehow or another a parent directory is getting returned in the wrong=
> > lock state. I'm not sure why...
> 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=
get to bad2 with ni_dvp unset. However we would have to be on a RO fs and=
(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,


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

Index: vfs_lookup.c
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;
+		if (cnp->cn_flags & PDIRUNLOCK)
+			dpunlocked =3D 1;
 		if (error !=3D EJUSTRETURN)
 			goto bad;


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

Version: GnuPG v1.2.3 (NetBSD)