mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
qtest: fix vhost-user-test unbalanced mutex locks
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
bd95939fc8
commit
f61badf32f
1 changed files with 2 additions and 2 deletions
|
@ -269,6 +269,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_mutex_lock(data_mutex);
|
||||||
memcpy(p, buf, VHOST_USER_HDR_SIZE);
|
memcpy(p, buf, VHOST_USER_HDR_SIZE);
|
||||||
|
|
||||||
if (msg.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 */
|
/* signal the test that it can continue */
|
||||||
g_cond_signal(data_cond);
|
g_cond_signal(data_cond);
|
||||||
g_mutex_unlock(data_mutex);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VHOST_USER_SET_VRING_KICK:
|
case VHOST_USER_SET_VRING_KICK:
|
||||||
|
@ -319,6 +319,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock(data_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *init_hugepagefs(void)
|
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 */
|
/* run the main loop thread so the chardev may operate */
|
||||||
data_mutex = _mutex_new();
|
data_mutex = _mutex_new();
|
||||||
data_cond = _cond_new();
|
data_cond = _cond_new();
|
||||||
g_mutex_lock(data_mutex);
|
|
||||||
_thread_new(NULL, thread_function, NULL);
|
_thread_new(NULL, thread_function, NULL);
|
||||||
|
|
||||||
qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
|
qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue