]> git.proxmox.com Git - mirror_qemu.git/commit
nbd-client: fix handling of hungup connections
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Mar 2017 11:11:56 +0000 (12:11 +0100)
committerMax Reitz <mreitz@redhat.com>
Mon, 27 Mar 2017 14:50:36 +0000 (16:50 +0200)
commita12a712a7dfbd2e2f4882ef2c90a9b2162166dd7
treee1eae825cb75759a62acc3e0ddd75ed064fc26b6
parentc919297379e9980c2bcc4d2053addbc1fd6d762b
nbd-client: fix handling of hungup connections

After the switch to reading replies in a coroutine, nothing is
reentering pending receive coroutines if the connection hangs.
Move nbd_recv_coroutines_enter_all to the reply read coroutine,
which is the place where hangups are detected.  nbd_teardown_connection
can simply wait for the reply read coroutine to detect the hangup
and clean up after itself.

This wouldn't be enough though because nbd_receive_reply returns 0
(rather than -EPIPE or similar) when reading from a hung connection.
Fix the return value check in nbd_read_reply_entry.

This fixes qemu-iotests 083.

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20170314111157.14464-1-pbonzini@redhat.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/nbd-client.c
nbd/client.c