svn commit: r280042 - head/usr.sbin/bhyve

Alexander Motin mav at FreeBSD.org
Sun Mar 15 16:18:05 UTC 2015


Author: mav
Date: Sun Mar 15 16:18:03 2015
New Revision: 280042
URL: https://svnweb.freebsd.org/changeset/base/280042

Log:
  Close potential race on blockif_close().
  
  Reported by:	vangyzen
  MFC after:	2 weeks

Modified:
  head/usr.sbin/bhyve/block_if.c

Modified: head/usr.sbin/bhyve/block_if.c
==============================================================================
--- head/usr.sbin/bhyve/block_if.c	Sun Mar 15 16:09:39 2015	(r280041)
+++ head/usr.sbin/bhyve/block_if.c	Sun Mar 15 16:18:03 2015	(r280042)
@@ -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);


More information about the svn-src-head mailing list