[Libguestfs] [nbdkit PATCH 3/3] connections: Don't send NBD_CMD_READ payload on error

Eric Blake eblake at redhat.com
Mon Nov 13 16:52:43 UTC 2017


The NBD spec was clarified to state that a payload for NBD_CMD_READ
must NOT be sent unless the error field is zero (see
https://github.com/NetworkBlockDevice/nbd/commit/e6c6fb39);
doing this makes us compatible with nbd-server and qemu-nbd.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/connections.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/connections.c b/src/connections.c
index 8d65e2a..46609f0 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -1016,7 +1016,7 @@ recv_request_send_reply (struct connection *conn)
   }

   /* Send the read data buffer. */
-  if (cmd == NBD_CMD_READ) {
+  if (cmd == NBD_CMD_READ && !error) {
     r = conn->send (conn, buf, count);
     if (r == -1) {
       nbdkit_error ("write data: %m");
-- 
2.13.6




More information about the Libguestfs mailing list