diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2019-07-17 16:05:57 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2020-01-23 16:41:37 +0000 |
commit | e7b337326d594b71b07cd6dbb332c49c122c80a4 (patch) | |
tree | f927a9d9c5baee3d1d3968b10ef768a55a2124a3 /default-configs/riscv32-linux-user.mak | |
parent | 620e9d8d9cee6df7fe71168dea950dba0cc21a4a (diff) |
virtiofsd: prevent fv_queue_thread() vs virtio_loop() races
We call into libvhost-user from the virtqueue handler thread and the
vhost-user message processing thread without a lock. There is nothing
protecting the virtqueue handler thread if the vhost-user message
processing thread changes the virtqueue or memory table while it is
running.
This patch introduces a read-write lock. Virtqueue handler threads are
readers. The vhost-user message processing thread is a writer. This
will allow concurrency for multiqueue in the future while protecting
against fv_queue_thread() vs virtio_loop() races.
Note that the critical sections could be made smaller but it would be
more invasive and require libvhost-user changes. Let's start simple and
improve performance later, if necessary. Another option would be an
RCU-style approach with lighter-weight primitives.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'default-configs/riscv32-linux-user.mak')
0 files changed, 0 insertions, 0 deletions