nbd: Properly mop up stranded requests
commita71bae8943bb44c6950c9dfc0673493f99d5c4b3
authorEric Blake <eblake@redhat.com>
Tue, 21 Nov 2017 20:45:34 +0000 (21 14:45 -0600)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 21 Nov 2017 21:03:44 +0000 (21 21:03 +0000)
treeadde8e8119dd8bce58cfe3ec57498c398a64735e
parent73282b173c0a5d5b30620f659fb0d8175f71a6f4
nbd: Properly mop up stranded requests

Nothing in the second loop of nbd_reader() was ever setting
quit; the only way the loop could end was via SEGV for
dereferencing NULL or abort() when attempting to write to
an invalid fd.  Finish the implementation to properly mop
up stranded in-flight requests.

The testsuite did not exercise the case of quitting
nbdkit while a transaction was in flight, but was relying
on SIGTERM exiting the entire process before all threads
were reaped; otherwise, I might have spotted this sooner.

Signed-off-by: Eric Blake <eblake@redhat.com>
plugins/nbd/nbd.c