From 8c0712fd88d3cf60dc9db5392b005583d540dc69 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 15 Oct 2012 13:40:07 -0700 Subject: [PATCH] Condition variable usage, zilog->zl_cv_batch The following incorrect usage of cv_signal and cv_broadcast() was caught by code inspection. The cv_signal and cv_broadcast() functions must be called under the associated mutex to preventing racing with cv_wait(). Signed-off-by: Brian Behlendorf --- module/zfs/zil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/zil.c b/module/zfs/zil.c index 292aea2..e76e5ec 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1560,13 +1560,14 @@ zil_commit(zilog_t *zilog, uint64_t foid) zil_commit_writer(zilog); zilog->zl_com_batch = mybatch; zilog->zl_writer = B_FALSE; - mutex_exit(&zilog->zl_lock); /* wake up one thread to become the next writer */ cv_signal(&zilog->zl_cv_batch[(mybatch+1) & 1]); /* wake up all threads waiting for this batch to be committed */ cv_broadcast(&zilog->zl_cv_batch[mybatch & 1]); + + mutex_exit(&zilog->zl_lock); } /* -- 1.8.3.1