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,
	 vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com,
	stefanha@redhat.com, fam@euphon.net
Subject: Re: [PATCH 3/5] block/nbd: Refresh the connection on block_resize
Date: Thu, 19 Nov 2026 10:25:24 -0600	[thread overview]
Message-ID: <av8ia-EWRqZXchhR@redhat.com> (raw)
In-Reply-To: <20261119144632.232457-4-guillaume.vincke@ovhcloud.com>

On Thu, Nov 19, 2026 at 03:46:30PM +0100, Guillaume Vincke wrote:
> When an NBD device is resized, two steps are needed to propagate the
> information. First, as the size is only exchanged at handshake, the
> connection needs to be reset. Then, the new size needs to be updated by
> calling bdrv_co_refresh_total_sectors().
> The QMP block_resize method, by calling bdrv_co_truncate(), takes care
> of the second step but, considering the NBD connection is lazy, nothing
> deals with reconnection when the device is idle.
> 
> This patch uses the new bdrv_co_refresh_connection() to force the
> handshake by manually starting the reconnection routine.
> It creates a clean flow to resize an NBD-backed block device on the
> server side by closing the connection and calling block_resize.
> When the node is configured with reconnect-delay=0, refreshing starts
> the reconnection but returns immediately with -EIO. The management
> application can handle this case by waiting for the connection to be
> established and re-running block_resize.
> 
> To detect disconnection, we peek the channel. This does not detect dead
> peers or disconnected TLS-secured connections. Therefore, this flow
> will not work if the server does not disconnect cleanly or if the
> communication is encrypted.

This is problematic, since unencrypted traffic is more likely to trip
over denial of service CVE attacks; is there any way we can make
client disconnect easier to detect even for TLS clients?

> 
> Signed-off-by: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
> ---

> +++ b/nbd/client-connection.c
> @@ -296,8 +296,11 @@ void nbd_client_connection_release(NBDClientConnection *conn)
>      }
>  }
>  
> -/* Only true when the peer closed the channel. Does not detect if dead. */
> -static bool nbd_channel_is_closed(QIOChannel *ioc)
> +/*
> + * Only true when the peer closed the channel. Always returns false for TLS
> + * channels. Does not detect if dead.
> + */
> +bool nbd_channel_is_closed(QIOChannel *ioc)
>  {
>      char data;
>      struct iovec iov = { .iov_base = &data, .iov_len = 1 };
> -- 
> 2.43.0
> 

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



  reply	other threads:[~2026-11-19 16:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 14:46 [PATCH 0/5] block/nbd: Fix block resize on idle device Guillaume Vincke
2026-11-19 14:46 ` [PATCH 1/5] block/nbd: Extract request slot access and reconnection Guillaume Vincke
2026-11-19 22:16   ` Eric Blake
2026-11-19 14:46 ` [PATCH 2/5] block: Refresh the connection before block_resize Guillaume Vincke
2026-11-19 22:32   ` Eric Blake
2026-11-20 10:40     ` guillaume vincke
2026-11-19 14:46 ` [PATCH 3/5] block/nbd: Refresh the connection on block_resize Guillaume Vincke
2026-11-19 16:25   ` Eric Blake [this message]
2026-11-20 10:12     ` guillaume vincke
2026-11-19 14:46 ` [PATCH 4/5] iotests: Add coverage for NBD resize Guillaume Vincke
2026-11-19 22:51   ` Eric Blake
2026-11-20 10:17     ` guillaume vincke
2026-11-19 14:46 ` [PATCH 5/5] block: Add refresh connection support to raw and luks Guillaume Vincke
2026-11-19 16:20 ` [PATCH 0/5] block/nbd: Fix block resize on idle device Eric Blake
2026-11-20 10:04   ` guillaume vincke

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=av8ia-EWRqZXchhR@redhat.com \
    --to=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=guillaume.vincke@ovhcloud.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --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.