Mercurial > illumos > illumos-gate
changeset 166:519e5268bee7
4657000 releasestr() should only wakeup waiters when sq_refcnt is zero.
author | xy158873 |
---|---|
date | Thu, 14 Jul 2005 02:13:33 -0700 |
parents | a09828a8566b |
children | a8cc53c680e2 |
files | usr/src/uts/common/os/strsubr.c usr/src/uts/common/sys/strsubr.h |
diffstat | 2 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/strsubr.c Thu Jul 14 02:05:20 2005 -0700 +++ b/usr/src/uts/common/os/strsubr.c Thu Jul 14 02:13:33 2005 -0700 @@ -633,6 +633,7 @@ mutex_init(&stp->sd_qlock, NULL, MUTEX_DEFAULT, NULL); cv_init(&stp->sd_monitor, NULL, CV_DEFAULT, NULL); cv_init(&stp->sd_iocmonitor, NULL, CV_DEFAULT, NULL); + cv_init(&stp->sd_refmonitor, NULL, CV_DEFAULT, NULL); cv_init(&stp->sd_qcv, NULL, CV_DEFAULT, NULL); cv_init(&stp->sd_zcopy_wait, NULL, CV_DEFAULT, NULL); stp->sd_wrq = NULL; @@ -651,6 +652,7 @@ mutex_destroy(&stp->sd_qlock); cv_destroy(&stp->sd_monitor); cv_destroy(&stp->sd_iocmonitor); + cv_destroy(&stp->sd_refmonitor); cv_destroy(&stp->sd_qcv); cv_destroy(&stp->sd_zcopy_wait); } @@ -4414,7 +4416,7 @@ mutex_enter(&stp1->sd_reflock); if (stp1->sd_refcnt > 0) { STRUNLOCKMATES(stp); - cv_wait(&stp1->sd_monitor, &stp1->sd_reflock); + cv_wait(&stp1->sd_refmonitor, &stp1->sd_reflock); mutex_exit(&stp1->sd_reflock); goto retry; } @@ -4422,7 +4424,7 @@ if (stp2->sd_refcnt > 0) { STRUNLOCKMATES(stp); mutex_exit(&stp1->sd_reflock); - cv_wait(&stp2->sd_monitor, &stp2->sd_reflock); + cv_wait(&stp2->sd_refmonitor, &stp2->sd_reflock); mutex_exit(&stp2->sd_reflock); goto retry; } @@ -4433,7 +4435,7 @@ mutex_enter(&stp->sd_reflock); while (stp->sd_refcnt > 0) { mutex_exit(&stp->sd_lock); - cv_wait(&stp->sd_monitor, &stp->sd_reflock); + cv_wait(&stp->sd_refmonitor, &stp->sd_reflock); if (mutex_tryenter(&stp->sd_lock) == 0) { mutex_exit(&stp->sd_reflock); mutex_enter(&stp->sd_lock); @@ -5435,8 +5437,8 @@ mutex_enter(&stp->sd_reflock); ASSERT(stp->sd_refcnt != 0); - stp->sd_refcnt--; - cv_broadcast(&stp->sd_monitor); + if (--stp->sd_refcnt == 0) + cv_broadcast(&stp->sd_refmonitor); mutex_exit(&stp->sd_reflock); }
--- a/usr/src/uts/common/sys/strsubr.h Thu Jul 14 02:05:20 2005 -0700 +++ b/usr/src/uts/common/sys/strsubr.h Thu Jul 14 02:13:33 2005 -0700 @@ -196,6 +196,7 @@ kmutex_t sd_lock; /* protect head consistency */ kcondvar_t sd_monitor; /* open/close/push/pop monitor */ kcondvar_t sd_iocmonitor; /* ioctl single-threading */ + kcondvar_t sd_refmonitor; /* sd_refcnt monitor */ ssize_t sd_qn_minpsz; /* These two fields are a performance */ ssize_t sd_qn_maxpsz; /* enhancements, cache the values in */ /* the stream head so we don't have */