14.04.2022 20:57, Paolo Bonzini wrote:
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
block/nbd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/nbd.c b/block/nbd.c
index 31c684772e..d0d94b40bd 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -81,12 +81,18 @@ typedef struct BDRVNBDState {
NBDClientRequest requests[MAX_NBD_REQUESTS];
QEMUTimer *reconnect_delay_timer;
+ /* Protects sending data on the socket. */
CoMutex send_mutex;
+
+ /*
+ * Protects receiving reply headers from the socket, as well as the
+ * fields reply and requests[].receiving
I think, worth noting, that s->reply is used without mutex after
nbd_receive_replies() success and till setting s->reply.handle to 0 in
nbd_co_receive_one_chunk()..
Should "s->reply.handle = 0" be done under mutex as well? And may be, in same
critical section as nbd_recv_coroutines_wake() ?
+ */
CoMutex receive_mutex;
+ NBDReply reply;
QEMUTimer *open_timer;
- NBDReply reply;
BlockDriverState *bs;
/* Connection parameters */
--
Best regards,
Vladimir