diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-03-11 21:26:09 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2025-03-13 17:57:23 +0100 |
commit | 7d8ab5b2f77d84a21dbeb5b254e26320e1943af4 (patch) | |
tree | 84ce6dc9a5fe5f1db50efdfcb207dfeffe0e71ac /include/hw/virtio | |
parent | b348ca2e043c0f7c9ecc1bbbd7dd87db47887e9f (diff) | |
download | qemu-7d8ab5b2f77d84a21dbeb5b254e26320e1943af4.zip qemu-7d8ab5b2f77d84a21dbeb5b254e26320e1943af4.tar.gz qemu-7d8ab5b2f77d84a21dbeb5b254e26320e1943af4.tar.bz2 |
virtio-scsi: protect events_dropped field
The block layer can invoke the resize callback from any AioContext that
is processing requests. The virtqueue is already protected but the
events_dropped field also needs to be protected against races. Cover it
using the event virtqueue lock because it is closely associated with
accesses to the virtqueue.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250311132616.1049687-7-stefanha@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/hw/virtio')
-rw-r--r-- | include/hw/virtio/virtio-scsi.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index 4ee98eb..7b7e3ce 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -82,10 +82,11 @@ struct VirtIOSCSI { SCSIBus bus; int resetting; /* written from main loop thread, read from any thread */ + + QemuMutex event_lock; /* protects event_vq and events_dropped */ bool events_dropped; QemuMutex ctrl_lock; /* protects ctrl_vq */ - QemuMutex event_lock; /* protects event_vq */ /* * TMFs deferred to main loop BH. These fields are protected by |