summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-04-14 19:57:56 +0200
committerEric Blake <eblake@redhat.com>2022-04-26 13:16:42 -0500
commit620c5cb5da57dc97f655e6218e7ca9bc896394a2 (patch)
tree31772b17286a6eae7ceba269db731127b674f474
parenta80a9a1c7397382fc4c4e6feaa8242b25cadb519 (diff)
downloadfocaccia-qemu-620c5cb5da57dc97f655e6218e7ca9bc896394a2.tar.gz
focaccia-qemu-620c5cb5da57dc97f655e6218e7ca9bc896394a2.zip
nbd: document what is protected by the CoMutexes
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220414175756.671165-10-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Lukas Straub <lukasstraub2@web.de>
Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--block/nbd.c8
1 files changed, 7 insertions, 1 deletions
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 */