mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00
contrib/libvhost-user: Protect slave fd with mutex
In future patches we'll be performing commands on the slave-fd driven by commands on queues, since those queues will be driven by individual threads we need to make sure they don't attempt to use the slave-fd for multiple commands in parallel. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
0fdc465d7d
commit
c25c02b9e6
2 changed files with 23 additions and 4 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <stddef.h>
|
||||
#include <sys/poll.h>
|
||||
#include <linux/vhost.h>
|
||||
#include <pthread.h>
|
||||
#include "standard-headers/linux/virtio_ring.h"
|
||||
|
||||
/* Based on qemu/hw/virtio/vhost-user.c */
|
||||
|
@ -355,6 +356,8 @@ struct VuDev {
|
|||
VuVirtq *vq;
|
||||
VuDevInflightInfo inflight_info;
|
||||
int log_call_fd;
|
||||
/* Must be held while using slave_fd */
|
||||
pthread_mutex_t slave_mutex;
|
||||
int slave_fd;
|
||||
uint64_t log_size;
|
||||
uint8_t *log_table;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue