svn commit: r350502 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Aug 1 14:34:28 UTC 2019


Author: kib
Date: Thu Aug  1 14:34:27 2019
New Revision: 350502
URL: https://svnweb.freebsd.org/changeset/base/350502

Log:
  Make umtxq_check_susp() to correctly handle thread exit requests.
  
  The check for P_SINGLE_EXIT was shadowed by the (P_SHOULDSTOP || traced) check.
  
  Reported by:	bdrewery (might be)
  Reviewed by:	markj
  Tested by:	pho
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21124

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Thu Aug  1 14:17:31 2019	(r350501)
+++ head/sys/kern/kern_umtx.c	Thu Aug  1 14:34:27 2019	(r350502)
@@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep)
 	error = 0;
 	p = td->td_proc;
 	PROC_LOCK(p);
-	if (P_SHOULDSTOP(p) ||
-	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
-		if (p->p_flag & P_SINGLE_EXIT)
-			error = EINTR;
-		else
-			error = sleep ? thread_suspend_check(0) : ERESTART;
-	}
+	if (p->p_flag & P_SINGLE_EXIT)
+		error = EINTR;
+	else if (P_SHOULDSTOP(p) ||
+	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
+		error = sleep ? thread_suspend_check(0) : ERESTART;
 	PROC_UNLOCK(p);
 	return (error);
 }


More information about the svn-src-all mailing list