summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-03-15 16:18:03 +0000
committermav <mav@FreeBSD.org>2015-03-15 16:18:03 +0000
commit72856e7d90c5821d32ac61c7304d0cfe43349877 (patch)
tree04387f187348253cbecaf911daed432e0ee066da /usr.sbin
parent2088070eaf7aa449b906195cdaf1149b3f342b09 (diff)
downloadFreeBSD-src-72856e7d90c5821d32ac61c7304d0cfe43349877.zip
FreeBSD-src-72856e7d90c5821d32ac61c7304d0cfe43349877.tar.gz
Close potential race on blockif_close().
Reported by: vangyzen MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/block_if.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c
index 68a9bae..58960ca 100644
--- a/usr.sbin/bhyve/block_if.c
+++ b/usr.sbin/bhyve/block_if.c
@@ -579,7 +579,9 @@ blockif_close(struct blockif_ctxt *bc)
/*
* Stop the block i/o thread
*/
+ pthread_mutex_lock(&bc->bc_mtx);
bc->bc_closing = 1;
+ pthread_mutex_unlock(&bc->bc_mtx);
pthread_cond_broadcast(&bc->bc_cond);
for (i = 0; i < BLOCKIF_NUMTHR; i++)
pthread_join(bc->bc_btid[i], &jval);
OpenPOWER on IntegriCloud