Skip to content

nbd: accept a large NBD_CMD_CACHE, cover the transmission commands

Denis V. Lunev qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyIn review
  2. v15 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- the libnbd handle now lives in setUp() and tearDown() instead of a context manager entered by every test case, which drops a level of indent everywhere (Vladimir)
- one block_status() helper returning a context to extents map, in place of the three near identical extent collecting callbacks (Vladimir)
- the unused callback arguments are named with a leading underscore, so that iotest 297 stays pylint clean; v1 added eight unused-argument warnings, which would have failed 297 wherever pylint is installed
- Vladimir's Reviewed-by is kept on patch 2, which is unchanged, and dropped from the four test patches, since the two points above rewrote most of the test

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5iotests: add coverage for NBD transmission commandstests/qemu-iotests/tests/nbd-commands tests/qemu-iotests/tests/nbd-commands.out+145 -00 replies
2/5nbd/server: accept NBD_CMD_CACHE above the maximum payload sizenbd/server.c tests/qemu-iotests/tests/nbd-commands+3 -60 replies
3/5iotests/nbd-commands: exercise the simple and structured reply modestests/qemu-iotests/tests/nbd-commands tests/qemu-iotests/tests/nbd-commands.out+31 -20 replies
4/5iotests/nbd-commands: cover NBD_CMD_BLOCK_STATUS with a payloadtests/qemu-iotests/tests/nbd-commands tests/qemu-iotests/tests/nbd-commands.out+14 -40 replies
5/5iotests/nbd-commands: cover the command flags and sparse repliestests/qemu-iotests/tests/nbd-commands tests/qemu-iotests/tests/nbd-commands.out+71 -50 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchVladimir Sementsov-Ogievskiy
SeriesR-b
1/5
2/5R-b
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] nbd: accept a large NBD_CMD_CACHE, cover the transmission commands

NBD_CMD_CACHE carries no payload in either direction, yet the server rejects any effect length above the advertised maximum payload size. The specification explicitly allows the oversize request, and we already accept it for NBD_CMD_TRIM and NBD_CMD_WRITE_ZEROES. Patch 2 drops the check.

The rest of the series adds tests/qemu-iotests/tests/nbd-commands, a small client which speaks the NBD transmission phase itself. Nothing in the tree does that today, so the protocol surface of the server - reply modes, command flags, error codes, sparse and extended replies - is covered only as far as our own client happens to exercise it. It is useful both as coverage and as a regression tool.

Changes since v1:
- the libnbd handle now lives in setUp() and tearDown() instead of a context manager entered by every test case, which drops a level of indent everywhere (Vladimir)
- one block_status() helper returning a context to extents map, in place of the three near identical extent collecting callbacks (Vladimir)
- the unused callback arguments are named with a leading underscore, so that iotest 297 stays pylint clean; v1 added eight unused-argument warnings, which would have failed 297 wherever pylint is installed
- Vladimir's Reviewed-by is kept on patch 2, which is unchanged, and dropped from the four test patches, since the two points above rewrote most of the test

v1: https://lore.kernel.org/qemu-devel/[email protected]/

CC Eric Blake <[email protected]>
CC Vladimir Sementsov-Ogievskiy <[email protected]>

Denis V. Lunev (5):
iotests: add coverage for NBD transmission commands nbd/server: accept NBD_CMD_CACHE above the maximum payload size iotests/nbd-commands: exercise the simple and structured reply modes iotests/nbd-commands: cover NBD_CMD_BLOCK_STATUS with a payload iotests/nbd-commands: cover the command flags and sparse replies

 nbd/server.c                              |   4 +-
 tests/qemu-iotests/tests/nbd-commands     | 244 ++++++++++++++++++++++
 tests/qemu-iotests/tests/nbd-commands.out |   5 +
 3 files changed, 250 insertions(+), 3 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/nbd-commands
 create mode 100644 tests/qemu-iotests/tests/nbd-commands.out

base-commit: bde2492aace2b5acb755a5b057013e915163a77f

Signature · 1 line
2.53.0