From owner-p4-projects Wed Feb 26 12: 5: 3 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9A81437B405; Wed, 26 Feb 2003 12:05:01 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 31C8637B401 for ; Wed, 26 Feb 2003 12:05:01 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D4C6343F75 for ; Wed, 26 Feb 2003 12:05:00 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h1QK500U006565 for ; Wed, 26 Feb 2003 12:05:00 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h1QK50j2006562 for perforce@freebsd.org; Wed, 26 Feb 2003 12:05:00 -0800 (PST) Date: Wed, 26 Feb 2003 12:05:00 -0800 (PST) Message-Id: <200302262005.h1QK50j2006562@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 25941 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=25941 Change 25941 by jhb@jhb_laptop on 2003/02/26 12:04:53 Replace a panic(2) implementation with the proper check. We have to check for owning the lock before we acquire it, not afterwards. Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#57 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#57 (text+ko) ==== @@ -452,19 +452,15 @@ MPASS(curthread != NULL); + KASSERT(!mtx_owned(m), + ("mtx_trylock() called on a mutex already owned")); + rval = _obtain_lock(m, curthread); LOCK_LOG_TRY("LOCK", &m->mtx_object, opts, rval, file, line); - if (rval) { - /* - * We do not handle recursion in _mtx_trylock; see the - * note at the top of the routine. - */ - KASSERT(!mtx_owned(m), - ("mtx_trylock() called on a mutex already owned")); + if (rval) WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE | LOP_TRYLOCK, file, line); - } return (rval); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message