nbd/client-connection: nbd_co_establish_connection(): return real error
commit169b9a94ed24a40b2bfc8664ecd2e75cd33d0978
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Mon, 6 Sep 2021 19:06:49 +0000 (6 22:06 +0300)
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tue, 21 Dec 2021 13:52:10 +0000 (21 14:52 +0100)
tree377e0e64385e96725f0af15e44614744392c4117
parentbe16b8bf9f231d19c172961d3327f9f72a7cd45f
nbd/client-connection: nbd_co_establish_connection(): return real error

The only caller of nbd_do_establish_connection() that uses errp is
nbd_open(). The only way to cancel this call is through open_timer
timeout. And for this case, user will be more interested in description
of last failed connect rather than in
"Connection attempt cancelled by other operation".

So, let's change behavior on cancel to return previous failure error if
available.

Do the same for non-blocking failure case. In this case we still don't
have a caller that is interested in errp. But let's be consistent.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
nbd/client-connection.c