All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	 Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH v2 2/2] iotests: Add coverage for NBD connect thread start delay
Date: Fri, 16 Oct 2026 09:13:52 -0500	[thread overview]
Message-ID: <atIvl0e9VddTigCO@redhat.com> (raw)
In-Reply-To: <20261016084136.233836-3-guillaume.vincke@ovhcloud.com>

On Fri, Oct 16, 2026 at 10:41:36AM +0200, Guillaume Vincke wrote:
> Test the connect thread starting condition with reconnect-delay=0 when
> the server disconnects after a successful handshake but before running
> operations. Prior to the change to nbd_co_establish_connection(), this
> test would demonstrate two I/O errors. The tests 264 and 277 covering
> reconnection do not use reconnect-delay=0 so this case is not exercised.
> 
> Add a test that provokes multiple errors in order to put an NBD client
> in the above-mentioned situation and shows that the first operation
> starts the connect thread and leads to successful subsequent I/O.
> 
> Signed-off-by: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
> ---
>  tests/qemu-iotests/tests/nbd-stale-connection | 60 +++++++++++++++++++
>  .../tests/nbd-stale-connection.out            | 17 ++++++
>  2 files changed, 77 insertions(+)
>  create mode 100755 tests/qemu-iotests/tests/nbd-stale-connection
>  create mode 100644 tests/qemu-iotests/tests/nbd-stale-connection.out

> +
> +# estimated duration required by the connect thread to reach a running server
> +MAX_NBD_CONNECT_DURATION = 1
> +

> +
> +    with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk):
> +        iotests.log('=== NBD server up. Wait for the connect thread to park '
> +                    'the channel ===')
> +        # in CONNECTING, the operation starts the connect thread
> +        log(vm.qmp('x-qemu-io', device='nbd0', command='write -P 0x5a 0 64k'))
> +        # wait for the connect thread to get a new channel and stop
> +        time.sleep(MAX_NBD_CONNECT_DURATION)

Timeout-based tests are always risky for false negatives when the CI
system has more load than the development system.  But comparing this
version of the patch to v1, it looks like you managed to get much more
reliable witness points.  I'll be running this through testing on my
own branch of gitlab several times to see if I can tease out any more
failures, but hopefully it is ready to use. I'll reply again once I've
made a decision on whether to include it in my current pull request or
defer it to my next batch of patches.

> +
> +    iotests.log('=== NBD server down. The parked channel is closed ===')
> +
> +    with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk):
> +        iotests.log('=== NBD server up. Restart the connect thread ===')
> +        # operation will determine that the channel got closed and restart the
> +        # connect thread
> +        log(vm.qmp('x-qemu-io', device='nbd0', command='write -P 0x5a 0 64k'))
> +        # Wait for it to succeed
> +        iotests.log('=== Wait for the connect thread to park the new channel. '
> +                    'Subsequent operations are successful ===')
> +        time.sleep(MAX_NBD_CONNECT_DURATION)
> +        log(vm.qmp('x-qemu-io', device='nbd0', command='write -P 0x5a 0 64k'))
> diff --git a/tests/qemu-iotests/tests/nbd-stale-connection.out b/tests/qemu-iotests/tests/nbd-stale-connection.out
> new file mode 100644
> index 0000000000..065ba329e9
> --- /dev/null
> +++ b/tests/qemu-iotests/tests/nbd-stale-connection.out
> @@ -0,0 +1,17 @@
> +Start NBD server
> +=== NBD Device connected ===
> +{"return": {}}
> +Kill NBD server
> +=== NBD server down. Detect the break and start the connect thread ===
> +{"error": {"class": "GenericError", "desc": "write failed: Input/output error"}}
> +Start NBD server
> +=== NBD server up. Wait for the connect thread to park the channel ===
> +{"error": {"class": "GenericError", "desc": "write failed: Input/output error"}}
> +Kill NBD server
> +=== NBD server down. The parked channel is closed ===
> +Start NBD server
> +=== NBD server up. Restart the connect thread ===
> +{"error": {"class": "GenericError", "desc": "write failed: Input/output error"}}
> +=== Wait for the connect thread to park the new channel. Subsequent operations are successful ===
> +{"return": {}}
> +Kill NBD server
> -- 
> 2.43.0
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



  reply	other threads:[~2026-10-16 14:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  8:41 [PATCH v2 0/2] nbd/client-connection: Fix client returning a closed channel Guillaume Vincke
2026-10-16  8:41 ` [PATCH v2 1/2] " Guillaume Vincke
2026-10-16  8:41 ` [PATCH v2 2/2] iotests: Add coverage for NBD connect thread start delay Guillaume Vincke
2026-10-16 14:13   ` Eric Blake [this message]
2026-10-16 15:15     ` guillaume vincke
2026-10-16 15:22     ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=atIvl0e9VddTigCO@redhat.com \
    --to=eblake@redhat.com \
    --cc=guillaume.vincke@ovhcloud.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.