]> git.ipfire.org Git - thirdparty/qemu.git/commit
nbd/server: introduce NBDClient->lock to protect fields
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 21 Dec 2023 19:24:52 +0000 (14:24 -0500)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 19 Mar 2024 16:45:50 +0000 (19:45 +0300)
commit13fc21ae3de6ad626cf920cc520c7db9157e4671
treeb7c758021c1abc5c8bcffebc5801626393cd1e3d
parentaee1039c61fab33a7a6b4e6474d8ad54514cdf4f
nbd/server: introduce NBDClient->lock to protect fields

NBDClient has a number of fields that are accessed by both the export
AioContext and the main loop thread. When the AioContext lock is removed
these fields will need another form of protection.

Add NBDClient->lock and protect fields that are accessed by both
threads. Also add assertions where possible and otherwise add doc
comments stating assumptions about which thread and lock holding.

Note this patch moves the client->recv_coroutine assertion from
nbd_co_receive_request() to nbd_trip() where client->lock is held.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20231221192452.1785567-7-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 7075d235114b40b30524cf1c5b61906c0bbf5f4d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
nbd/server.c