qemu-patch-raspberry4/nbd
Sergio Lopez fd6afc501a nbd/server: Use drained block ops to quiesce the server
Before switching between AioContexts we need to make sure that we're
fully quiesced ("nb_requests == 0" for every client) when entering the
drained section.

To do this, we set "quiescing = true" for every client on
".drained_begin" to prevent new coroutines from being created, and
check if "nb_requests == 0" on ".drained_poll". Finally, once we're
exiting the drained section, on ".drained_end" we set "quiescing =
false" and call "nbd_client_receive_next_request()" to resume the
processing of new requests.

With these changes, "blk_aio_attach()" and "blk_aio_detach()" can be
reverted to be as simple as they were before f148ae7d36.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1960137
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Message-Id: <20210602060552.17433-3-slp@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-06-02 14:23:20 +02:00
..
client.c nbd: Use ERRP_GUARD() 2020-07-10 15:18:09 +02:00
common.c nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO 2019-09-05 16:03:13 -05:00
meson.build block: move block exports to libblockdev 2020-10-23 13:42:16 +01:00
nbd-internal.h configure: Add a proper check for sys/ioccom.h and use it in tpm_ioctl.h 2020-11-17 09:45:24 +01:00
server.c nbd/server: Use drained block ops to quiesce the server 2021-06-02 14:23:20 +02:00
trace-events trace: Remove trailing newline in events 2019-09-18 10:19:47 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00