diff options
author | Ari Sundholm <ari@tuxera.com> | 2024-01-19 18:29:13 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2024-01-26 11:16:58 +0100 |
commit | a26d018c94ec367172d8376f00be4a31f74bf0d2 (patch) | |
tree | ef620fb72589f9e312bd73589e1759b9b17b67c2 /tests/unit | |
parent | d3f6f294aeadd5f88caf0155e4360808c95b3146 (diff) | |
download | qemu-a26d018c94ec367172d8376f00be4a31f74bf0d2.zip qemu-a26d018c94ec367172d8376f00be4a31f74bf0d2.tar.gz qemu-a26d018c94ec367172d8376f00be4a31f74bf0d2.tar.bz2 |
block/blklogwrites: Protect mutable driver state with a mutex.
During the review of a fix for a concurrency issue in blklogwrites,
it was found that the driver needs an additional fix when enabling
multiqueue, which is a new feature introduced in QEMU 9.0, as the
driver state may be read and written by multiple threads at the same
time, which was not the case when the driver was originally written.
Fix the multi-threaded scenario by introducing a mutex to protect the
mutable fields in the driver state, and always having the mutex locked
by the current thread when accessing them. Also use the mutex and a
CoQueue to ensure that the super block is not being written to by
multiple threads concurrently and updates are properly serialized.
Additionally, add the const qualifier to a few BDRVBlkLogWritesState
pointer targets in contexts where the driver state is not written to.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Message-ID: <20240119162913.2620245-1-ari@tuxera.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/unit')
0 files changed, 0 insertions, 0 deletions