Skip to content
Snippets Groups Projects
  1. Oct 12, 2023
  2. Oct 05, 2023
    • Eric Blake's avatar
      nbd/client: Accept 64-bit block status chunks · a7c18670
      Eric Blake authored
      
      Once extended mode is enabled, we need to accept 64-bit status replies
      (even for replies that don't exceed a 32-bit length).  It is easier to
      normalize narrow replies into wide format so that the rest of our code
      only has to handle one width.  Although a server is non-compliant if
      it sends a 64-bit reply in compact mode, or a 32-bit reply in extended
      mode, it is still easy enough to tolerate these mismatches.
      
      In normal execution, we are only requesting "base:allocation" which
      never exceeds 32 bits for flag values. But during testing with
      x-dirty-bitmap, we can force qemu to connect to some other context
      that might have 64-bit status bit; however, we ignore those upper bits
      (other than mapping qemu:allocation-depth into something that
      'qemu-img map --output=json' can expose), and since that only affects
      testing, we really don't bother with checking whether more than the
      two least-significant bits are set.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      Message-ID: <20230925192229.3186470-22-eblake@redhat.com>
      a7c18670
    • Eric Blake's avatar
      nbd/client: Initial support for extended headers · 4fc55bf3
      Eric Blake authored
      
      Update the client code to be able to send an extended request, and
      parse an extended header from the server.  Note that since we reject
      any structured reply with a too-large payload, we can always normalize
      a valid header back into the compact form, so that the caller need not
      deal with two branches of a union.  Still, until a later patch lets
      the client negotiate extended headers, the code added here should not
      be reached.  Note that because of the different magic numbers, it is
      just as easy to trace and then tolerate a non-compliant server sending
      the wrong header reply as it would be to insist that the server is
      compliant.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-ID: <20230925192229.3186470-21-eblake@redhat.com>
      [eblake: fix trace format]
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      4fc55bf3
    • Eric Blake's avatar
      nbd/client: Plumb errp through nbd_receive_replies · ed6c996c
      Eric Blake authored
      
      Instead of ignoring the low-level error just to refabricate our own
      message to pass to the caller, we can just plumb the caller's errp
      down to the low level.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-ID: <20230925192229.3186470-20-eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      ed6c996c
  3. Sep 29, 2023
  4. Sep 26, 2023
  5. Sep 25, 2023
    • Eric Blake's avatar
      nbd: Prepare for 64-bit request effect lengths · b2578459
      Eric Blake authored
      
      Widen the length field of NBDRequest to 64-bits, although we can
      assert that all current uses are still under 32 bits: either because
      of NBD_MAX_BUFFER_SIZE which is even smaller (and where size_t can
      still be appropriate, even on 32-bit platforms), or because nothing
      ever puts us into NBD_MODE_EXTENDED yet (and while future patches will
      allow larger transactions, the lengths in play here are still capped
      at 32-bit).  There are no semantic changes, other than a typo fix in a
      couple of error messages.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-ID: <20230829175826.377251-23-eblake@redhat.com>
      [eblake: fix assertion bug in nbd_co_send_simple_reply]
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      b2578459
  6. Sep 22, 2023
    • Eric Blake's avatar
      nbd: Add types for extended headers · d95ffb6f
      Eric Blake authored
      
      Add the constants and structs necessary for later patches to start
      implementing the NBD_OPT_EXTENDED_HEADERS extension in both the client
      and server, matching recent upstream nbd.git (through commit
      e6f3b94a934).  This patch does not change any existing behavior, but
      merely sets the stage for upcoming patches.
      
      This patch does not change the status quo that neither the client nor
      server use a packed-struct representation for the request header.
      While most of the patch adds new types, there is also some churn for
      renaming the existing NBDExtent to NBDExtent32 to contrast it with
      NBDExtent64, which I thought was a nicer name than NBDExtentExt.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      Message-ID: <20230829175826.377251-22-eblake@redhat.com>
      d95ffb6f
    • Eric Blake's avatar
      nbd/client: Pass mode through to nbd_send_request · 297365b4
      Eric Blake authored
      
      Once the 64-bit headers extension is enabled, the data layout we send
      over the wire for a client request depends on the mode negotiated with
      the server.  Rather than adding a parameter to nbd_send_request, we
      can add a member to struct NBDRequest, since it already does not
      reflect on-wire format.  Some callers initialize it directly; many
      others rely on a common initialization point during
      nbd_co_send_request().  At this point, there is no semantic change.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      Message-ID: <20230829175826.377251-21-eblake@redhat.com>
      297365b4
    • Eric Blake's avatar
      nbd: Replace bool structured_reply with mode enum · ac132d05
      Eric Blake authored
      
      The upcoming patches for 64-bit extensions requires various points in
      the protocol to make decisions based on what was negotiated.  While we
      could easily add a 'bool extended_headers' alongside the existing
      'bool structured_reply', this does not scale well if more modes are
      added in the future.  Better is to expose the mode enum added in the
      recent commit bfe04d0a out to a wider use in the code base.
      
      Where the code previously checked for structured_reply being set or
      clear, it now prefers checking for an inequality; this works because
      the nodes are in a continuum of increasing abilities, and allows us to
      touch fewer places if we ever insert other modes in the middle of the
      enum.  There should be no semantic change in this patch.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-ID: <20230829175826.377251-20-eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      ac132d05
  7. Sep 21, 2023
Loading