diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2019-03-01 11:18:30 +0000 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2020-01-23 16:41:37 +0000 |
commit | c25c02b9e6a196be87a818f459c426556b24770d (patch) | |
tree | f15922ebddc7d38806b3ed54d6982b8a13184ad3 /contrib/libvhost-user/libvhost-user.h | |
parent | 0fdc465d7d5aafeae127eba488f247ac6f58df4c (diff) | |
download | qemu-c25c02b9e6a196be87a818f459c426556b24770d.zip |
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>
Diffstat (limited to 'contrib/libvhost-user/libvhost-user.h')
-rw-r--r-- | contrib/libvhost-user/libvhost-user.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/libvhost-user.h index 46b600799b..1844b6f8d4 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -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; |