From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz6YS-0003jD-A7 for qemu-devel@nongnu.org; Mon, 23 Jun 2014 11:53:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz6YI-0001JF-5P for qemu-devel@nongnu.org; Mon, 23 Jun 2014 11:53:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz6YH-0001Ic-T8 for qemu-devel@nongnu.org; Mon, 23 Jun 2014 11:53:02 -0400 Date: Mon, 23 Jun 2014 18:53:21 +0300 From: "Michael S. Tsirkin" Message-ID: <1403538745-18622-7-git-send-email-mst@redhat.com> References: <1403538745-18622-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403538745-18622-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 06/23] qtest: fix vhost-user-test unbalanced mutex locks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Nikolay Nikolaev , Anthony Liguori , Antonios Motakis From: Nikolay Nikolaev Signed-off-by: Nikolay Nikolaev Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2934379..2af2381 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -269,6 +269,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) return; } + g_mutex_lock(data_mutex); memcpy(p, buf, VHOST_USER_HDR_SIZE); if (msg.size) { @@ -302,7 +303,6 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) /* signal the test that it can continue */ g_cond_signal(data_cond); - g_mutex_unlock(data_mutex); break; case VHOST_USER_SET_VRING_KICK: @@ -319,6 +319,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) default: break; } + g_mutex_unlock(data_mutex); } static const char *init_hugepagefs(void) @@ -385,7 +386,6 @@ int main(int argc, char **argv) /* run the main loop thread so the chardev may operate */ data_mutex = _mutex_new(); data_cond = _cond_new(); - g_mutex_lock(data_mutex); _thread_new(NULL, thread_function, NULL); qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path); -- MST