Page MenuHomeFreeBSD

D57887.id180715.diff
No OneTemporary

D57887.id180715.diff

diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c
--- a/usr.sbin/bhyve/block_if.c
+++ b/usr.sbin/bhyve/block_if.c
@@ -479,7 +479,7 @@
char name[MAXPATHLEN];
const char *path, *pssval, *ssval, *bootindex_val;
char *cp;
- struct blockif_ctxt *bc;
+ struct blockif_ctxt *bc = NULL;
struct stat sbuf;
struct diocgattr_arg arg;
off_t size, psectsz, psectoff;
@@ -671,6 +671,12 @@
return (bc);
err:
+ if (bc != NULL) {
+ pthread_mutex_destroy(&bc->bc_mtx);
+ pthread_cond_destroy(&bc->bc_cond);
+ pthread_cond_destroy(&bc->bc_work_done_cond);
+ free(bc);
+ }
if (fd >= 0)
close(fd);
return (NULL);
@@ -849,11 +855,11 @@
* Interrupt the processing thread to force it return
* prematurely via it's normal callback path.
*/
+ struct blockif_sig_elem bse;
+ pthread_mutex_init(&bse.bse_mtx, NULL);
+ pthread_cond_init(&bse.bse_cond, NULL);
while (be->be_status == BST_BUSY) {
- struct blockif_sig_elem bse, *old_head;
-
- pthread_mutex_init(&bse.bse_mtx, NULL);
- pthread_cond_init(&bse.bse_cond, NULL);
+ struct blockif_sig_elem *old_head;
bse.bse_pending = 1;
@@ -872,6 +878,8 @@
pthread_mutex_unlock(&bse.bse_mtx);
}
+ pthread_mutex_destroy(&bse.bse_mtx);
+ pthread_cond_destroy(&bse.bse_cond);
pthread_mutex_unlock(&bc->bc_mtx);
/*
@@ -895,7 +903,7 @@
pthread_mutex_lock(&bc->bc_mtx);
bc->bc_closing = 1;
if (bc->bc_resize_event != NULL)
- mevent_disable(bc->bc_resize_event);
+ mevent_delete(bc->bc_resize_event);
pthread_mutex_unlock(&bc->bc_mtx);
pthread_cond_broadcast(&bc->bc_cond);
for (i = 0; i < BLOCKIF_NUMTHR; i++)
@@ -908,6 +916,9 @@
*/
bc->bc_magic = 0;
close(bc->bc_fd);
+ pthread_mutex_destroy(&bc->bc_mtx);
+ pthread_cond_destroy(&bc->bc_cond);
+ pthread_cond_destroy(&bc->bc_work_done_cond);
free(bc);
return (0);

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 6, 5:17 PM (1 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34405559
Default Alt Text
D57887.id180715.diff (1 KB)

Event Timeline