From patchwork Thu Jun 19 15:08:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 361906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 68D7A14007C for ; Fri, 20 Jun 2014 01:09:44 +1000 (EST) Received: from localhost ([::1]:36176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxdyA-0005eD-Ge for incoming@patchwork.ozlabs.org; Thu, 19 Jun 2014 11:09:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxdx6-0003m6-0k for qemu-devel@nongnu.org; Thu, 19 Jun 2014 11:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wxdww-000442-Fu for qemu-devel@nongnu.org; Thu, 19 Jun 2014 11:08:35 -0400 Received: from mail-we0-f182.google.com ([74.125.82.182]:38764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxdww-00042w-Ar for qemu-devel@nongnu.org; Thu, 19 Jun 2014 11:08:26 -0400 Received: by mail-we0-f182.google.com with SMTP id q59so2512827wes.27 for ; Thu, 19 Jun 2014 08:08:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=acvBNjbb3RqfUHpakClriDHjYbVfv/dwFZTWlS/2MHs=; b=mKRaJEKwzn62WhEGwwWTKyEtGqiOSdMY/k6CmvN/WAuru69Ip8IjjSYzyqQALr6mfC mCAo2d59PG1Vy6ksVqq19LdGLxEYbrLAf1y6uEVkljrFjhTFoTr/M63KMCwnhM10Quqo FALPw6080Z6ba/iSKpsOgC4YNfXlrhoW0ii0Vi2uloLRXkQckcHoCPRk0NTMfiyvjry/ LYDWExgtgWxetRbB37GZjtewzqT0y2z8kbWMPfqPuoaBiK9TAhdhq8yPBdvZ4DHkM8Ki yGsYTRZ3Ca/68U6N7yIzZqPFLUDAgXbHDUdgxVQBmgdNYW9ajsRK4IxDw1uX5nco6jMG 2vKw== X-Gm-Message-State: ALoCoQkJXaBodLcvg8eQjx6kIDfixqrSs7WReNPnOhYjKRZ4jd4AMS066FCBuTO5iRFQHiQz+SpW X-Received: by 10.194.110.161 with SMTP id ib1mr3940515wjb.129.1403190505609; Thu, 19 Jun 2014 08:08:25 -0700 (PDT) Received: from [0.0.14.236] ([82.146.27.14]) by mx.google.com with ESMTPSA id e11sm12299647wiw.19.2014.06.19.08.08.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 08:08:24 -0700 (PDT) From: Nikolay Nikolaev To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org, mst@redhat.com Date: Thu, 19 Jun 2014 18:08:18 +0300 Message-ID: <20140619150811.10499.43830.stgit@3820> In-Reply-To: <20140619150355.10499.53297.stgit@3820> References: <20140619150355.10499.53297.stgit@3820> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.182 Cc: tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com Subject: [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Nikolay Nikolaev --- 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);