svn commit: r332076 - stable/11/sys/sys

Mark Johnston markj at FreeBSD.org
Thu Apr 5 15:37:50 UTC 2018


Author: markj
Date: Thu Apr  5 15:37:49 2018
New Revision: 332076
URL: https://svnweb.freebsd.org/changeset/base/332076

Log:
  MFC r331738, r331853:
  Have TD_LOCKS_DEC() assert that td_locks is positive.

Modified:
  stable/11/sys/sys/proc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/proc.h
==============================================================================
--- stable/11/sys/sys/proc.h	Thu Apr  5 15:00:08 2018	(r332075)
+++ stable/11/sys/sys/proc.h	Thu Apr  5 15:37:49 2018	(r332076)
@@ -377,7 +377,11 @@ do {									\
 } while (0)
 
 #define	TD_LOCKS_INC(td)	((td)->td_locks++)
-#define	TD_LOCKS_DEC(td)	((td)->td_locks--)
+#define	TD_LOCKS_DEC(td) do {						\
+	KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0,		\
+	    ("thread %p owns no locks", (td)));				\
+	(td)->td_locks--;						\
+} while (0)
 #else
 #define	THREAD_LOCKPTR_ASSERT(td, lock)
 


More information about the svn-src-all mailing list