diff options
author | Christopher Baumbauer - Oracle America - San Diego United States <Chris.Baumbauer@Oracle.COM> | 2010-04-05 09:00:34 -0700 |
---|---|---|
committer | Christopher Baumbauer - Oracle America - San Diego United States <Chris.Baumbauer@Oracle.COM> | 2010-04-05 09:00:34 -0700 |
commit | e24ad0477f696e85e5b6abbf799db570859969a6 (patch) | |
tree | a8cdebebd42a21162282d9532ddd844799fdc18d /usr | |
parent | 10c0e3a0a02dbeae36ec05595be6fe0539935270 (diff) | |
download | illumos-gate-e24ad0477f696e85e5b6abbf799db570859969a6.tar.gz |
6904937 thread spinning in anon_array_enter causing ps and other proc tools to hang
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/uts/common/fs/proc/prvnops.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr/src/uts/common/fs/proc/prvnops.c b/usr/src/uts/common/fs/proc/prvnops.c index 855e82007a..a3e95a60fc 100644 --- a/usr/src/uts/common/fs/proc/prvnops.c +++ b/usr/src/uts/common/fs/proc/prvnops.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -864,6 +863,7 @@ pr_read_map_common(prnode_t *pnp, uio_t *uiop, prnodetype_t type) list_t iolhead; int error; +readmap_common: if ((error = prlock(pnp, ZNO)) != 0) return (error); @@ -875,8 +875,13 @@ pr_read_map_common(prnode_t *pnp, uio_t *uiop, prnodetype_t type) return (0); } + if (!AS_LOCK_TRYENTER(as, &as->a_lock, RW_WRITER)) { + prunlock(pnp); + delay(1); + goto readmap_common; + } mutex_exit(&p->p_lock); - AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER); + switch (type) { case PR_XMAP: error = prgetxmap(p, &iolhead); @@ -888,6 +893,7 @@ pr_read_map_common(prnode_t *pnp, uio_t *uiop, prnodetype_t type) error = prgetmap(p, 0, &iolhead); break; } + AS_LOCK_EXIT(as, &as->a_lock); mutex_enter(&p->p_lock); prunlock(pnp); @@ -1942,6 +1948,7 @@ pr_read_map_common_32(prnode_t *pnp, uio_t *uiop, prnodetype_t type) list_t iolhead; int error; +readmap32_common: if ((error = prlock(pnp, ZNO)) != 0) return (error); @@ -1958,8 +1965,13 @@ pr_read_map_common_32(prnode_t *pnp, uio_t *uiop, prnodetype_t type) return (EOVERFLOW); } + if (!AS_LOCK_TRYENTER(as, &as->a_lock, RW_WRITER)) { + prunlock(pnp); + delay(1); + goto readmap32_common; + } mutex_exit(&p->p_lock); - AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER); + switch (type) { case PR_XMAP: error = prgetxmap32(p, &iolhead); |