Date: Wed, 26 Feb 2003 12:05:00 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 25941 for review Message-ID: <200302262005.h1QK50j2006562@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302262005.h1QK50j2006562>