Mercurial > illumos > illumos-gate
changeset 10541:7163a22234ca
6814187 running newtask -c pid, could hang the system in pool code if the target process is in lwp_create
author | Gangadhar Mylapuram <Gangadhar.M@Sun.COM> |
---|---|
date | Mon, 14 Sep 2009 23:58:59 -0700 |
parents | 1e419e4bc6a6 |
children | ef3706982293 |
files | usr/src/uts/common/os/lwp.c |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/lwp.c Mon Sep 14 23:39:39 2009 -0700 +++ b/usr/src/uts/common/os/lwp.c Mon Sep 14 23:58:59 2009 -0700 @@ -58,6 +58,7 @@ #include <sys/cmn_err.h> #include <sys/brand.h> #include <sys/cyclic.h> +#include <sys/pool.h> /* hash function for the lwpid hash table, p->p_tidhash[] */ #define TIDHASH(tid, hash_sz) ((tid) & ((hash_sz) - 1)) @@ -394,8 +395,22 @@ * 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