From 936e3a339b40ec2e8d0c2f59281e1c4b5e484f55 Mon Sep 17 00:00:00 2001 From: Gangadhar Mylapuram Date: Mon, 14 Sep 2009 23:58:59 -0700 Subject: 6814187 running newtask -c pid, could hang the system in pool code if the target process is in lwp_create --- usr/src/uts/common/os/lwp.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'usr/src/uts/common/os/lwp.c') diff --git a/usr/src/uts/common/os/lwp.c b/usr/src/uts/common/os/lwp.c index bf827dd106..45eaff29ef 100644 --- a/usr/src/uts/common/os/lwp.c +++ b/usr/src/uts/common/os/lwp.c @@ -58,6 +58,7 @@ #include #include #include +#include /* hash function for the lwpid hash table, p->p_tidhash[] */ #define TIDHASH(tid, hash_sz) ((tid) & ((hash_sz) - 1)) @@ -394,8 +395,22 @@ grow: * We rely on stop() to call prbarrier(p) before returning. */ while ((curthread->t_proc_flag & TP_PRSTOP) && - !ttolwp(curthread)->lwp_nostop) + !ttolwp(curthread)->lwp_nostop) { + /* + * We called pool_barrier_enter() before calling + * here to lwp_create(). We have to call + * pool_barrier_exit() before stopping. + */ + pool_barrier_exit(); + prbarrier(p); stop(PR_REQUESTED, 0); + /* + * And we have to repeat the call to + * pool_barrier_enter after stopping. + */ + pool_barrier_enter(); + prbarrier(p); + } /* * If process is exiting, there could be a race between -- cgit v1.2.3