qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] nbd/client: Relax handling of large NBD_CMD_BLO


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH] nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply
Date: Tue, 29 May 2018 18:34:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

04.05.2018 01:26, Eric Blake wrote:
The NBD spec is proposing a relaxation of NBD_CMD_BLOCK_STATUS
where a server may have the final extent per context give a
length beyond the original request, if it can easily prove that
subsequent bytes have the same status, on the grounds that a
client can take advantage of this information for fewer block
status requests.  Since qemu 2.12 as a client always sends
NBD_CMD_FLAG_REQ_ONE, and rejects a server that sends extra
length, the upstream NBD spec will probably limit this behavior
to clients that don't request REQ_ONE semantics; but it doesn't
hurt to relax qemu to always be permissive of this server
behavior, even if it continues to use REQ_ONE.

Hi!

Patch is applied, are you going to make a patch for NBD spec?


Signed-off-by: Eric Blake <address@hidden>
---
  block/nbd-client.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index e7caf49fbb4..25d34631fe7 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -259,14 +259,18 @@ static int nbd_parse_blockstatus_payload(NBDClientSession 
*client,

      if (extent->length == 0 ||
          (client->info.min_block && !QEMU_IS_ALIGNED(extent->length,
-                                                    client->info.min_block)) ||
-        extent->length > orig_length)
-    {
+                                                    client->info.min_block))) {
          error_setg(errp, "Protocol error: server sent status chunk with "
                     "invalid length");
          return -EINVAL;
      }

+    /* The server is allowed to send us extra information on the final
+     * extent; just clamp it to the length we requested. */
+    if (extent->length > orig_length) {
+        extent->length == orig_length;
+    }
+
      return 0;
  }



--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]