diff options
| author | xy158873 <none@none> | 2005-07-14 02:13:33 -0700 |
|---|---|---|
| committer | xy158873 <none@none> | 2005-07-14 02:13:33 -0700 |
| commit | 6829c6461622d30263484b8bbb1676b3146f2414 (patch) | |
| tree | 82f1fb214d84f704f10d71b4e7bccf55be6b5707 /usr/src/uts/common/os/strsubr.c | |
| parent | 049304ffca09aea028be9d98eb50ac5a603b50f7 (diff) | |
| download | illumos-joyent-6829c6461622d30263484b8bbb1676b3146f2414.tar.gz | |
4657000 releasestr() should only wakeup waiters when sq_refcnt is zero.
Diffstat (limited to 'usr/src/uts/common/os/strsubr.c')
| -rw-r--r-- | usr/src/uts/common/os/strsubr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c index 703d4b8f03..c37fab366c 100644 --- a/usr/src/uts/common/os/strsubr.c +++ b/usr/src/uts/common/os/strsubr.c @@ -633,6 +633,7 @@ stream_head_constructor(void *buf, void *cdrarg, int kmflags) 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 @@ stream_head_destructor(void *buf, void *cdrarg) 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 @@ retry: 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 @@ retry: 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 @@ retry: 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 @@ releasestr(queue_t *qp) 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); } |
