[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 1/5] block/nbd: nbd_channel_error() shutdown channel uncon
From: |
Eric Blake |
Subject: |
Re: [PATCH v6 1/5] block/nbd: nbd_channel_error() shutdown channel unconditionally |
Date: |
Fri, 3 Sep 2021 11:16:33 -0500 |
User-agent: |
NeoMutt/20210205-739-420e15 |
On Thu, Sep 02, 2021 at 01:38:01PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Don't rely on connection being totally broken in case of -EIO. More
> safe and correct just shutdown the channel anyway, as we change the
> state and going to reconnect.
If you don't mind me tweaking grammar, I propose:
Safer and more correct is to just shut down the channel anyway, since
we change the state and plan on reconnecting.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
> block/nbd.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/block/nbd.c b/block/nbd.c
> index f6ff1c4fb4..d88f4b954c 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -129,15 +129,16 @@ static bool nbd_client_connected(BDRVNBDState *s)
>
> static void nbd_channel_error(BDRVNBDState *s, int ret)
> {
> + if (nbd_client_connected(s)) {
> + qio_channel_shutdown(s->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
> + }
> +
> if (ret == -EIO) {
> if (nbd_client_connected(s)) {
> s->state = s->reconnect_delay ? NBD_CLIENT_CONNECTING_WAIT :
> NBD_CLIENT_CONNECTING_NOWAIT;
> }
> } else {
> - if (nbd_client_connected(s)) {
> - qio_channel_shutdown(s->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
> - }
> s->state = NBD_CLIENT_QUIT;
> }
> }
> --
> 2.29.2
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v6 0/5] block/nbd: drop connection_co, Vladimir Sementsov-Ogievskiy, 2021/09/02
- [PATCH v6 1/5] block/nbd: nbd_channel_error() shutdown channel unconditionally, Vladimir Sementsov-Ogievskiy, 2021/09/02
- Re: [PATCH v6 1/5] block/nbd: nbd_channel_error() shutdown channel unconditionally,
Eric Blake <=
- [PATCH v6 2/5] block/nbd: move nbd_recv_coroutines_wake_all() up, Vladimir Sementsov-Ogievskiy, 2021/09/02
- [PATCH v6 3/5] block/nbd: refactor nbd_recv_coroutines_wake_all(), Vladimir Sementsov-Ogievskiy, 2021/09/02
- [PATCH v6 4/5] block/nbd: drop connection_co, Vladimir Sementsov-Ogievskiy, 2021/09/02
- [PATCH v6 5/5] block/nbd: check that received handle is valid, Vladimir Sementsov-Ogievskiy, 2021/09/02
- Re: [PATCH v6 0/5] block/nbd: drop connection_co, Vladimir Sementsov-Ogievskiy, 2021/09/22