block/nbd: Fix hang in .bdrv_close()
authorMax Reitz <mreitz@redhat.com>
Wed, 22 Jan 2020 16:45:28 +0000 (17:45 +0100)
committerMax Reitz <mreitz@redhat.com>
Thu, 20 Feb 2020 15:43:42 +0000 (16:43 +0100)
commit78c81a3f108870d325b0a39d88711366afe6f703
tree40bcae73956c2f70c6bb90f4eaa41fc16641c88d
parentb7e9eae98c160f3e7eb9ffbedba8821e358d963c
block/nbd: Fix hang in .bdrv_close()

When nbd_close() is called from a coroutine, the connection_co never
gets to run, and thus nbd_teardown_connection() hangs.

This is because aio_co_enter() only puts the connection_co into the main
coroutine's wake-up queue, so this main coroutine needs to yield and
wait for connection_co to terminate.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200122164532.178040-2-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/nbd.c