[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/9] nbd/client-connection: nbd_co_establish_connection():
From: |
Eric Blake |
Subject: |
Re: [PATCH v3 1/9] nbd/client-connection: nbd_co_establish_connection(): fix non set errp |
Date: |
Tue, 7 Sep 2021 12:44:53 -0500 |
User-agent: |
NeoMutt/20210205-739-420e15 |
On Mon, Sep 06, 2021 at 10:06:46PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> When we don't have a connection and blocking is false, we return NULL
> but don't set errp. That's wrong.
Oops...
>
> We have two paths for calling nbd_co_establish_connection():
>
> 1. nbd_open() -> nbd_do_establish_connection() -> ...
> but that will never set blocking=false
>
> 2. nbd_reconnect_attempt() -> nbd_co_do_establish_connection() -> ...
> but that uses errp=NULL
>
> So, we are safe with our wrong errp policy in
> nbd_co_establish_connection(). Still let's fix it.
...phew! Thus, it's not critical to backport.
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> nbd/client-connection.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/nbd/client-connection.c b/nbd/client-connection.c
> index 7123b1e189..695f855754 100644
> --- a/nbd/client-connection.c
> +++ b/nbd/client-connection.c
> @@ -318,6 +318,7 @@ nbd_co_establish_connection(NBDClientConnection *conn,
> NBDExportInfo *info,
> }
>
> if (!blocking) {
> + error_setg(errp, "No connection at the moment");
> return NULL;
> }
>
> --
> 2.29.2
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v3 0/9] nbd reconnect on open, Vladimir Sementsov-Ogievskiy, 2021/09/06
- [PATCH v3 1/9] nbd/client-connection: nbd_co_establish_connection(): fix non set errp, Vladimir Sementsov-Ogievskiy, 2021/09/06
- Re: [PATCH v3 1/9] nbd/client-connection: nbd_co_establish_connection(): fix non set errp,
Eric Blake <=
- [PATCH v3 3/9] nbd: allow reconnect on open, with corresponding new options, Vladimir Sementsov-Ogievskiy, 2021/09/06
- [PATCH v3 4/9] nbd/client-connection: nbd_co_establish_connection(): return real error, Vladimir Sementsov-Ogievskiy, 2021/09/06
- [PATCH v3 2/9] qapi: make blockdev-add a coroutine command, Vladimir Sementsov-Ogievskiy, 2021/09/06