DragonFly bugs List (threaded) for 2009-04
DragonFly BSD
DragonFly bugs List (threaded) for 2009-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: panic: lockmgr: locking against myself


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Apr 2009 10:15:08 -0700 (PDT)

:It solves the problem with panic and makes kdesu actually work as well, 
:but it breaks other things like sh and ssh (and probably more :):

    Ow.  Ok, I see what I did.  I guess I'm not supposed to 
    NULL-out s_ttyvp there :-)

    I'll just use a ref instead so the vrele inside the VOP_CLOSE
    doesn't trigger the reclaim.  The original use of vhold/vdrop was
    because the reference count was being used to figure out when to
    disassociate the tty.  I fixed the use of v_opencount and the code
    uses that now, so we should be able to safely use vref/vrele instead
    of vhold/vdrop.

    I'm going to hold off the release by one day and get this committed,
    please test it today and Monday.

						-Matt

diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index ce27467..9b73517 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -135,22 +135,22 @@ retry:
 		/*
 		 * Avoid a nasty race if we block while getting the lock.
 		 */
-		vhold(ttyvp);
+		vref(ttyvp);
 		error = vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY);
 		if (error) {
-			vdrop(ttyvp);
+			vrele(ttyvp);
 			goto retry;
 		}
 		if (ttyvp != cttyvp(p) || (ttyvp->v_flag & VCTTYISOPEN) == 0) {
 			kprintf("Warning: cttyclose: race avoided\n");
 			vn_unlock(ttyvp);
-			vdrop(ttyvp);
+			vrele(ttyvp);
 			goto retry;
 		}
 		vclrflags(ttyvp, VCTTYISOPEN);
 		error = VOP_CLOSE(ttyvp, FREAD|FWRITE);
 		vn_unlock(ttyvp);
-		vdrop(ttyvp);
+		vrele(ttyvp);
 	} else {
 		error = 0;
 	}



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]