panic: lockmgr: locking against myself

Matthew Dillon dillon at
Sat Apr 25 18:12:03 PDT 2009

:Fresh build, full hammer setup and triggered by kdesu (KDE wrapper for su 
:command). The panic is 100% reproduceable. Core is uploaded into leaf.

    I think I see what's going on here.  It's double-closing the
    tty vnode.  It looks like the case can occur if the process doing
    it is in the background and all other references have gone away.

    Please try this patch and tell me if it solves the problem.


diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index ce27467..d013009 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -147,10 +147,12 @@ retry:
 			goto retry;
+		p->p_session->s_ttyvp = NULL;
 		vclrflags(ttyvp, VCTTYISOPEN);
 		error = VOP_CLOSE(ttyvp, FREAD|FWRITE);
+		vrele(ttyvp);	/* ref from s_ttyvp */
 	} else {
 		error = 0;

More information about the Bugs mailing list