From 620c5cb5da57dc97f655e6218e7ca9bc896394a2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 14 Apr 2022 19:57:56 +0200 Subject: [PATCH] nbd: document what is protected by the CoMutexes Signed-off-by: Paolo Bonzini Message-Id: <20220414175756.671165-10-pbonzini@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Lukas Straub Signed-off-by: Eric Blake --- block/nbd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/nbd.c b/block/nbd.c index 3bfcf4d97c..6085ab1d2c 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 + */ CoMutex receive_mutex; + NBDReply reply; QEMUTimer *open_timer; - NBDReply reply; BlockDriverState *bs; /* Connection parameters */