Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Apr 2018 15:37:49 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332076 - stable/11/sys/sys
Message-ID:  <201804051537.w35FbnCh079531@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804051537.w35FbnCh079531>