qemu-patch-raspberry4/nbd
Vladimir Sementsov-Ogievskiy a0d7ce20a9 nbd/server: fix: check client->closing before sending reply
Since the unchanged code has just set client->recv_coroutine to
NULL before calling nbd_client_receive_next_request(), we are
spawning a new coroutine unconditionally, but the first thing
that coroutine will do is check for client->closing, making it
a no-op if we have already detected that the client is going
away.  Furthermore, for any error other than EIO (where we
disconnect, which itself sets client->closing), if the client
has already gone away, we'll probably encounter EIO later
in the function and attempt disconnect at that point.  Logically,
as soon as we know the connection is closing, there is no need
to try a likely-to-fail a response or spawn a no-op coroutine.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20180308184636.178534-4-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: squash in further reordering: hoist check before spawning
next coroutine, and document rationale in commit message]
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-13 15:38:55 -05:00
..
client.c qio: non-default context for TLS handshake 2018-03-06 10:19:07 +00:00
common.c nbd: BLOCK_STATUS constants 2018-03-01 14:05:24 -06:00
Makefile.objs nbd: Split nbd.c 2016-01-15 18:58:02 +01:00
nbd-internal.h nbd: Minimal structured read for client 2017-10-30 21:48:41 +01:00
server.c nbd/server: fix: check client->closing before sending reply 2018-03-13 15:38:55 -05:00
trace-events nbd/client: fix error messages in nbd_handle_reply_err 2018-03-01 14:48:23 -06:00