All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org, mst@redhat.com
Cc: tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com
Subject: [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks
Date: Thu, 19 Jun 2014 18:08:18 +0300	[thread overview]
Message-ID: <20140619150811.10499.43830.stgit@3820> (raw)
In-Reply-To: <20140619150355.10499.53297.stgit@3820>

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
 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);

  parent reply	other threads:[~2014-06-19 15:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
2014-06-19 15:35   ` Michael S. Tsirkin
2014-06-19 15:38     ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char Nikolay Nikolaev
2014-06-19 16:06   ` Andrew Jones
2014-06-19 15:07 ` [Qemu-devel] [PATCH 3/6] qtest: fix qtest for vhost-user Nikolay Nikolaev
2014-06-19 15:08 ` Nikolay Nikolaev [this message]
2014-06-19 15:08 ` [Qemu-devel] [PATCH 5/6] vhost: fix migration_blocker initialization Nikolay Nikolaev
2014-06-19 15:09 ` [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test Nikolay Nikolaev
2014-06-19 15:41   ` Michael S. Tsirkin
2014-06-19 17:18     ` Paolo Bonzini
2014-06-19 15:48 ` [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Michael S. Tsirkin
2014-06-19 15:55   ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
2014-06-19 16:20     ` Nikolay Nikolaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140619150811.10499.43830.stgit@3820 \
    --to=n.nikolaev@virtualopensystems.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=snabb-devel@googlegroups.com \
    --cc=tech@virtualopensystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.