v3: Rework previous patch 2 (fix the busy loop bug and split to two patches). [Paolo]
During nbd_send_negotiate, if the client simply doesn't respond, the function will not return, and the whole event loop is blocked. Make the I/O effectively asynchronous by using coroutine read/write, so that a malicious or disappeared client cannot make a hang. Fam Fam Zheng (3): nbd: Always call "close_fn" in nbd_client_new nbd: Split nbd.c nbd-server: Coroutine based negotiation MAINTAINERS | 5 +- Makefile.objs | 3 +- blockdev-nbd.c | 5 +- include/block/nbd-internal.h | 113 +++++++++ include/block/nbd.h | 3 +- nbd/Makefile.objs | 1 + nbd/client.c | 361 ++++++++++++++++++++++++++ nbd/common.c | 64 +++++ nbd.c => nbd/server.c | 588 ++++++++----------------------------------- qemu-nbd.c | 10 +- tests/qemu-iotests/083 | 2 +- 11 files changed, 649 insertions(+), 506 deletions(-) create mode 100644 include/block/nbd-internal.h create mode 100644 nbd/Makefile.objs create mode 100644 nbd/client.c create mode 100644 nbd/common.c rename nbd.c => nbd/server.c (62%) -- 2.4.3