Author: delphij Date: Mon Sep 30 06:38:34 2019 New Revision: 352890 URL: https://svnweb.freebsd.org/changeset/base/352890
Log: MFC r351417: r351417: INVARIANTS: treat LA_LOCKED as the same of LA_XLOCKED in mtx_assert. Modified: stable/12/sys/kern/kern_mutex.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_mutex.c ============================================================================== --- stable/12/sys/kern/kern_mutex.c Mon Sep 30 06:09:32 2019 (r352889) +++ stable/12/sys/kern/kern_mutex.c Mon Sep 30 06:38:34 2019 (r352890) @@ -176,6 +176,21 @@ void assert_mtx(const struct lock_object *lock, int what) { + /* + * Treat LA_LOCKED as if LA_XLOCKED was asserted. + * + * Some callers of lc_assert uses LA_LOCKED to indicate that either + * a shared lock or write lock was held, while other callers uses + * the more strict LA_XLOCKED (used as MA_OWNED). + * + * Mutex is the only lock class that can not be shared, as a result, + * we can reasonably consider the caller really intends to assert + * LA_XLOCKED when they are asserting LA_LOCKED on a mutex object. + */ + if (what & LA_LOCKED) { + what &= ~LA_LOCKED; + what |= LA_XLOCKED; + } mtx_assert((const struct mtx *)lock, what); } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"