summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/lwp.c
diff options
context:
space:
mode:
authorGangadhar Mylapuram <Gangadhar.M@Sun.COM>2009-09-14 23:58:59 -0700
committerGangadhar Mylapuram <Gangadhar.M@Sun.COM>2009-09-14 23:58:59 -0700
commit936e3a339b40ec2e8d0c2f59281e1c4b5e484f55 (patch)
tree74ff845932eee023456bead8368fc610ae0eca44 /usr/src/uts/common/os/lwp.c
parent7d87efa8fdfb9453670f2832df666fdae8291a84 (diff)
downloadillumos-gate-936e3a339b40ec2e8d0c2f59281e1c4b5e484f55.tar.gz
6814187 running newtask -c pid, could hang the system in pool code if the target process is in lwp_create
Diffstat (limited to 'usr/src/uts/common/os/lwp.c')
-rw-r--r--usr/src/uts/common/os/lwp.c17
1 files changed, 16 insertions, 1 deletions
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 <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 @@ 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