NBD client relies on lazy reconnection on error. There is a case where nbd_co_establish_connection() will hand back a channel disconnected by its peer. This leads to the request running on the dead channel. When reconnect-delay is set to 0 (the default), this bug prevents the nbd-connect thread from running on the first operation. This patch set addresses this specific case.
Found while searching for a way to force client reconnection to simplify the resize of idle nodes which will be the subject of another patch set. v1: https://patchew.org/QEMU/[email protected]/ v1 -> v2: - patch 1: Pick up Eric Blake's formatting changes. - patch 2: Start the connect thread after the NBD server so the test no longer depends on the 1s connect retry, which made v1 fail in CI. Raise the connect wait to 1s. Guillaume Vincke (2): nbd/client-connection: Fix client returning a closed channel iotests: Add coverage for NBD connect thread start delay nbd/client-connection.c | 32 ++++++++++ tests/qemu-iotests/tests/nbd-stale-connection | 60 +++++++++++++++++++ .../tests/nbd-stale-connection.out | 17 ++++++ 3 files changed, 109 insertions(+) create mode 100755 tests/qemu-iotests/tests/nbd-stale-connection create mode 100644 tests/qemu-iotests/tests/nbd-stale-connection.out -- 2.43.0
