1. 09 Mar, 2022 4 commits
  2. 18 Jan, 2021 2 commits
  3. 17 Jan, 2021 1 commit
  4. 06 Oct, 2020 2 commits
  5. 05 Oct, 2020 1 commit
  6. 17 Mar, 2020 1 commit
  7. 07 Feb, 2020 2 commits
    • Wouter Verhelst's avatar
      NBD_REP_ERR_PLATFORM: make useful · cb20c163
      Wouter Verhelst authored
      "not available on this platform" is rather weird, and probably too narrow a
      choice. "not enabled at compile time" might be slightly more useful, and
      nbd-server uses that for STARTTLS when it was disabled currently.
      
      This might be a good idea, so explicitly allow for it.
      cb20c163
    • Vladimir Sementsov-Ogievskiy's avatar
      doc/proto: drop max-block restriction for data-less commands · 9f30fedb
      Vladimir Sementsov-Ogievskiy authored and Wouter Verhelst's avatar Wouter Verhelst committed
      
      
      max-block restriction make sense for NBD_CMD_WRITE and NBD_CMD_READ to
      avoid big data transfer and long io operations at server side.
      NBD_CMD_WRITE_ZEROES still may be realized on server through direct
      writing zeroes, which may lead to long operation and huge allocation
      and should be restricted by max-block.
      Same for NBD_CMD_CACHE: long operation / big allocation.
      
      Still, NBD_CMD_TRIM, NBD_CMD_BLOCK_STATUS and NBD_CMD_WRITE_ZEROES with
      NBD_CMD_FLAG_FAST_ZERO set are over-restricted by it. So, for better
      performance, drop these restrictions.
      
      Note, that Qemu nbd server already works accordingly to this patch: it
      doesn't check the restriction for NBD_CMD_TRIM, NBD_CMD_BLOCK_STATUS
      and NBD_CMD_WRITE_ZEROES.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      9f30fedb
  8. 01 Jan, 2020 1 commit
  9. 11 Dec, 2019 1 commit
  10. 06 Oct, 2019 1 commit
  11. 16 Sep, 2019 3 commits
  12. 03 Sep, 2019 2 commits
    • Richard W.M. Jones's avatar
      doc: Define a standard URI syntax for NBD URIs. · 8065a509
      Richard W.M. Jones authored
      For further information about discussion around this standard, see
      this thread on the mailing list:
      https://lists.debian.org/nbd/2019/05/msg00013.html
      
      
      
      Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
      [eblake: couple of typo fixes]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      8065a509
    • Eric Blake's avatar
      protocol: Add NBD_CMD_FLAG_FAST_ZERO · 9376d16f
      Eric Blake authored
      While it may be counterintuitive at first, the introduction of
      NBD_CMD_WRITE_ZEROES and NBD_CMD_BLOCK_STATUS has caused a performance
      regression in qemu [1], when copying a sparse file. When the
      destination file must contain the same contents as the source, but it
      is not known in advance whether the destination started life with all
      zero content, then there are cases where it is faster to request a
      bulk zero of the entire device followed by writing only the portions
      of the device that are to contain data, as that results in fewer I/O
      transactions overall. In fact, there are even situations where
      trimming the entire device prior to writing zeroes may be faster than
      bare write zero request [2]. However, if a bulk zero request ever
      falls back to the same speed as a normal write, a bulk pre-zeroing
      algorithm is actually a pessimization, as it ends up writing portions
      of the disk twice.
      
      [1] https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg06389.html
      [2] https://github.com/libguestfs/nbdkit/commit/407f8dde
      
      
      
      Hence, it is desirable to have a way for clients to specify that a
      particular write zero request is being attempted for a fast wipe, and
      get an immediate failure if the zero request would otherwise take the
      same time as a write.  Conversely, if the client is not performing a
      pre-initialization pass, it is still more efficient in terms of
      networking traffic to send NBD_CMD_WRITE_ZERO requests where the
      server implements the fallback to the slower write, than it is for the
      client to have to perform the fallback to send NBD_CMD_WRITE with a
      zeroed buffer.
      
      Add a protocol flag and corresponding transmission advertisement flag
      to make it easier for clients to inform the server of their intent. If
      the server advertises NBD_FLAG_SEND_FAST_ZERO, then it promises two
      things: to perform a fallback to write when the client does not
      request NBD_CMD_FLAG_FAST_ZERO (so that the client benefits from the
      lower network overhead); and to fail quickly with ENOTSUP, preferably
      without modifying the export, if the client requested the flag but the
      server cannot write zeroes more efficiently than a normal write (so
      that the client is not penalized with the time of writing data areas
      of the disk twice).
      
      Note that the semantics are chosen so that servers should advertise
      the new flag whether or not they have fast zeroing (that is, this is
      NOT the server advertising that it has fast zeroes, but rather
      advertising that the client can get fast feedback as needed on whether
      zeroing is fast).  It is also intentional that the new advertisement
      includes a new errno value, ENOTSUP, with rules that this error should
      not be returned for any pre-existing behaviors, must not happen when
      the client does not request a fast zero, and must be returned quickly
      if the client requested fast zero but anything other than the error
      would not be fast; while leaving it possible for clients to
      distinguish other errors like EINVAL if alignment constraints are not
      met.  Clients should not send the flag unless the server advertised
      support, but well-behaved servers should already be reporting EINVAL
      to unrecognized flags. If the server does not advertise the new
      feature, clients can safely fall back to assuming that writing zeroes
      is no faster than normal writes (whether or not the assumption
      actually holds).
      
      Note that the Linux fallocate(2) interface may or may not be powerful
      enough to easily determine if zeroing will be efficient - in
      particular, FALLOC_FL_ZERO_RANGE in isolation does NOT give that
      insight; likewise, for block devices, it is known that
      ioctl(BLKZEROOUT) does NOT have a way for userspace to probe if it is
      efficient or slow.  But with enough demand, the kernel may add another
      FALLOC_FL_ flag to use with FALLOC_FL_ZERO_RANGE, and/or appropriate
      ioctls with guaranteed ENOTSUP failures if a fast path cannot be
      taken.  If a server cannot easily determine if write zeroes will be
      efficient, the server should either fail all NBD_CMD_FLAG_FAST_ZERO
      with ENOTSUP, or else choose to not advertise NBD_FLAG_SEND_FAST_ZERO.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      9376d16f
  13. 02 Aug, 2019 7 commits
  14. 01 Aug, 2019 3 commits
  15. 31 Jul, 2019 1 commit
  16. 04 Jun, 2019 1 commit
    • Eric Blake's avatar
      docs: Recommend TCP_NODELAY (disabling Nagle) · cdb0bc57
      Eric Blake authored
      This text from https://en.wikipedia.org/wiki/Nagle%27s_algorithm
      is telling:
      
      "In any request-response application protocols where request data can
      be larger than a packet, this can artificially impose a few hundred
      milliseconds latency between the requester and the responder, even if
      the requester has properly buffered the request data. Nagle's
      algorithm should be disabled by the requester in this case. If the
      response data can be larger than a packet, the responder should also
      disable Nagle's algorithm so the requester can promptly receive the
      whole response."
      
      And we hit it in real life with libnbd/nbdkit - more than an order of
      magnitude in slowdown results when trying to saturate a connection
      with as many parallel requests as possible when Nagle's algorithm
      introduces artificial delay waiting for the ACKs:
      https://www.redhat.com/archives/libguestfs/2019-May/msg00237.html
      
      
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      cdb0bc57
  17. 25 May, 2019 3 commits
  18. 23 May, 2019 1 commit
    • Kevin Daudt's avatar
      Segfault in nbd-server.c due to calling freeaddrinfo on NULL · 590ec9b4
      Kevin Daudt authored and Wouter Verhelst's avatar Wouter Verhelst committed
      In set_peername, when netaddr.ss_family == AF_UNIX. ai is never initialized.
      
      On line 1733, freeaddrinfo is called unconditionally on ai, which might be NULL
      in some cases.
      
      The musl implementation of getaddrinfo started to segfault when you pass it
      NULL. This caused some of the tests to fail on Alpine Linux, namely simple_test
      inetd and unix.
      
      This patch was enough to fix the issue
      590ec9b4
  19. 22 May, 2019 1 commit
  20. 14 May, 2019 1 commit
  21. 01 May, 2019 1 commit
    • Eric Blake's avatar
      doc: Tweak naming of NBD errors · 7f5d2aa9
      Eric Blake authored
      
      
      It is intentional that we send NBD-specific error values over the
      wire, which (due to history) happen to match particular Linux errno
      values, but which may not match on other systems.  To make it more
      obvious that a mapping is involved (both for the server converting
      local errno values into wire values, and in clients converting wire
      values back into any human messages via strerror() or similar), update
      the protocol specification to refer to NBD errors with an NBD_E
      prefix.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      7f5d2aa9