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
This commit is contained in:
Konstantin Belousov 2019-08-01 14:34:27 +00:00
parent 20abea6663
commit 5cbdd18fd4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350502

View File

@ -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);
}