From owner-p4-projects Tue Mar 11 13:15:14 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 304FE37B404; Tue, 11 Mar 2003 13:15:12 -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 BD19E37B401 for ; Tue, 11 Mar 2003 13:15:11 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B04543FBF for ; Tue, 11 Mar 2003 13:15:11 -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 h2BLFB0U084074 for ; Tue, 11 Mar 2003 13:15:11 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h2BLFAhr084071 for perforce@freebsd.org; Tue, 11 Mar 2003 13:15:10 -0800 (PST) Date: Tue, 11 Mar 2003 13:15:10 -0800 (PST) Message-Id: <200303112115.h2BLFAhr084071@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 26720 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=26720 Change 26720 by jhb@jhb_laptop on 2003/03/11 13:14:58 Fail mtx_trylock() if lock is already owned and not recursable (recursive?). Also, add a KASSERT so that if you aren't using WITNESS _mtx_lock_sleep() will fail if the lock isn't recursable (recursive?) instead of recursively acquiring the lock anyways. Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#64 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#64 (text+ko) ==== @@ -464,7 +464,7 @@ MPASS(curthread != NULL); - if (mtx_owned(m)) { + if (mtx_owned(m) && (m->mtx_object.lo_flags & LO_RECURSABLE) != 0) { m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); rval = 1; @@ -499,6 +499,9 @@ #endif if (mtx_owned(m)) { + KASSERT((m->mtx_object.lo_flags & LO_RECURSABLE) != 0, + ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n", + m->mtx_object.lo_name, file, line)); m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); if (LOCK_LOG_TEST(&m->mtx_object, opts)) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message