From owner-svn-soc-all@FreeBSD.ORG Sun Jul 14 06:52:29 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 31B63CE8 for ; Sun, 14 Jul 2013 06:52:29 +0000 (UTC) (envelope-from zcore@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) by mx1.freebsd.org (Postfix) with ESMTP id 22FE4793 for ; Sun, 14 Jul 2013 06:52:29 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6E6qSJd036546 for ; Sun, 14 Jul 2013 06:52:28 GMT (envelope-from zcore@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r6E6qSTn036540 for svn-soc-all@FreeBSD.org; Sun, 14 Jul 2013 06:52:28 GMT (envelope-from zcore@FreeBSD.org) Date: Sun, 14 Jul 2013 06:52:28 GMT Message-Id: <201307140652.r6E6qSTn036540@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to zcore@FreeBSD.org using -f From: zcore@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254775 - soc2013/zcore/head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jul 2013 06:52:29 -0000 Author: zcore Date: Sun Jul 14 06:52:28 2013 New Revision: 254775 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254775 Log: fix block_if two bugs 1. add missing pthread_mutex_unlock() after pthread_cond_wait() 2. add missing pthread_cond_signal() before pthread_join() Modified: soc2013/zcore/head/usr.sbin/bhyve/block_if.c Modified: soc2013/zcore/head/usr.sbin/bhyve/block_if.c ============================================================================== --- soc2013/zcore/head/usr.sbin/bhyve/block_if.c Sun Jul 14 04:42:35 2013 (r254774) +++ soc2013/zcore/head/usr.sbin/bhyve/block_if.c Sun Jul 14 06:52:28 2013 (r254775) @@ -159,14 +159,13 @@ pthread_mutex_lock(&bc->bc_mtx); } pthread_cond_wait(&bc->bc_cond, &bc->bc_mtx); + pthread_mutex_unlock(&bc->bc_mtx); /* * Check ctxt status here to see if exit requested */ - if (bc->bc_closing) { - pthread_mutex_unlock(&bc->bc_mtx); + if (bc->bc_closing) pthread_exit(NULL); - } } /* Not reached */ @@ -247,7 +246,7 @@ pthread_create(&bc->bc_btid, NULL, blockif_thr, bc); - snprintf(tname, sizeof(tname), "%s blk-%s", vmname, ident); + snprintf(tname, sizeof(tname), "%s blk-%s", vmname, ident); pthread_set_name_np(bc->bc_btid, tname); return (bc); @@ -321,6 +320,7 @@ * Stop the block i/o thread */ bc->bc_closing = 1; + pthread_cond_signal(&bc->bc_cond); pthread_join(bc->bc_btid, &jval); /* XXX Cancel queued i/o's ??? */