summaryrefslogtreecommitdiffstats
path: root/module/zfs/zil.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-10-15 13:40:07 -0700
committerBrian Behlendorf <[email protected]>2012-10-15 16:01:58 -0700
commit8c0712fd88d3cf60dc9db5392b005583d540dc69 (patch)
treefb6665b1c20e9808e85cf584e2b363175944ba8b /module/zfs/zil.c
parent99db9bfde70440475a37c0e1b985efbec4850a8c (diff)
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 <[email protected]>
Diffstat (limited to 'module/zfs/zil.c')
-rw-r--r--module/zfs/zil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/zil.c b/module/zfs/zil.c
index 292aea27d..e76e5ecf1 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);
}
/*