v2: Adopt Daniel and Paolo's idea: always call close_fn. 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 (2): nbd: Always call "close_fn" in nbd_client_new nbd: Coroutine based nbd_send_negotiate blockdev-nbd.c | 5 ++-- include/block/nbd.h | 3 +-- nbd.c | 73 ++++++++++++++++++++++++++++++++++++++--------------- qemu-nbd.c | 10 +++----- 4 files changed, 58 insertions(+), 33 deletions(-) -- 2.4.3