Date: Tue, 11 Mar 2003 13:15:10 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 26720 for review Message-ID: <200303112115.h2BLFAhr084071@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303112115.h2BLFAhr084071>