Close potential race on blockif_close().

Reported by:	vangyzen
MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2015-03-15 16:18:03 +00:00
parent 7315946b80
commit f2e62de7d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280042

View File

@ -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);