Mercurial > illumos > illumos-gate
changeset 10667:bc413e63c72c
6277113 kstat qlen == 0 panic during completion or mirrored write
author | Ray Hassan <Ray.Hassan@Sun.COM> |
---|---|
date | Mon, 28 Sep 2009 16:13:05 +0100 |
parents | 48f9827bb5cf |
children | e0d0c98c8bae |
files | usr/src/uts/common/io/lvm/md/md_subr.c |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/io/lvm/md/md_subr.c Mon Sep 28 07:34:34 2009 -0700 +++ b/usr/src/uts/common/io/lvm/md/md_subr.c Mon Sep 28 16:13:05 2009 +0100 @@ -1126,8 +1126,20 @@ /* teardown kstat, return success */ if (! (ui->ui_lock & MD_UL_OPEN)) { - mutex_exit(&ui->ui_mx); - md_kstat_destroy(mnum); + + /* + * We have a race condition inherited from specfs between + * open() and close() calls. This results in the kstat + * for a pending I/O being torn down, and then a panic. + * To avoid this, only tear the kstat down if there are + * no other readers on this device. + */ + if (ui->ui_readercnt > 1) { + mutex_exit(&ui->ui_mx); + } else { + mutex_exit(&ui->ui_mx); + md_kstat_destroy(mnum); + } return (0); }