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; error = 0;
p = td->td_proc; p = td->td_proc;
PROC_LOCK(p); PROC_LOCK(p);
if (P_SHOULDSTOP(p) || if (p->p_flag & P_SINGLE_EXIT)
((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) { error = EINTR;
if (p->p_flag & P_SINGLE_EXIT) else if (P_SHOULDSTOP(p) ||
error = EINTR; ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
else error = sleep ? thread_suspend_check(0) : ERESTART;
error = sleep ? thread_suspend_check(0) : ERESTART;
}
PROC_UNLOCK(p); PROC_UNLOCK(p);
return (error); return (error);
} }