qemu-irix/block
Stefan Hajnoczi 40f4a21895 nbd-client: avoid spurious qio_channel_yield() re-entry
The following scenario leads to an assertion failure in
qio_channel_yield():

1. Request coroutine calls qio_channel_yield() successfully when sending
   would block on the socket.  It is now yielded.
2. nbd_read_reply_entry() calls nbd_recv_coroutines_enter_all() because
   nbd_receive_reply() failed.
3. Request coroutine is entered and returns from qio_channel_yield().
   Note that the socket fd handler has not fired yet so
   ioc->write_coroutine is still set.
4. Request coroutine attempts to send the request body with nbd_rwv()
   but the socket would still block.  qio_channel_yield() is called
   again and assert(!ioc->write_coroutine) is hit.

The problem is that nbd_read_reply_entry() does not distinguish between
request coroutines that are waiting to receive a reply and those that
are not.

This patch adds a per-request bool receiving flag so
nbd_read_reply_entry() can avoid spurious aio_wake() calls.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20170822125113.5025-1-stefanha@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2017-08-23 11:22:15 -05:00
..
Makefile.objs
accounting.c
backup.c
blkdebug.c
blkreplay.c
blkverify.c
block-backend.c block-backend: Allow more "can inactivate" cases 2017-08-23 10:21:55 -05:00
bochs.c
cloop.c
commit.c block: Skip implicit nodes in query-block/blockstats 2017-07-24 15:06:04 +02:00
crypto.c
crypto.h
curl.c
dirty-bitmap.c
dmg-bz2.c
dmg.c
dmg.h
file-posix.c file-posix: Do runtime check for ofd lock API 2017-08-11 14:12:44 +02:00
file-win32.c
gluster.c
io.c block: move trace probes into bdrv_co_preadv|pwritev 2017-08-07 09:39:35 +01:00
iscsi-opts.c
iscsi.c
linux-aio.c
mirror.c mirror: Mark target BB as "force allow inactivate" 2017-08-23 10:21:55 -05:00
nbd-client.c nbd-client: avoid spurious qio_channel_yield() re-entry 2017-08-23 11:22:15 -05:00
nbd-client.h nbd-client: avoid spurious qio_channel_yield() re-entry 2017-08-23 11:22:15 -05:00
nbd.c
nfs.c block/nfs: fix mutex assertion in nfs_file_close() 2017-08-08 15:19:16 +02:00
null.c block/null: Remove 'filename' option 2017-08-08 15:19:16 +02:00
parallels.c parallels: drop check that bdrv_truncate() is working 2017-08-08 15:19:16 +02:00
qapi.c block/qapi: Remove redundant NULL check to silence Coverity 2017-08-01 18:09:33 +02:00
qcow.c qcow: fix memory leaks related to encryption 2017-07-25 16:33:31 +02:00
qcow2-bitmap.c qcow2-bitmap: fix bitmap_free 2017-07-25 16:33:31 +02:00
qcow2-cache.c
qcow2-cluster.c
qcow2-refcount.c qcow2: fix null pointer dereference 2017-07-31 13:06:38 +03:00
qcow2-snapshot.c
qcow2.c qcow2: Check failure of bdrv_getlength() 2017-08-11 13:23:47 +02:00
qcow2.h
qed-check.c
qed-cluster.c
qed-l2-cache.c
qed-table.c
qed.c
qed.h
quorum.c quorum: Set sectors-count to 0 when reporting a flush error 2017-08-08 14:37:00 +02:00
raw-format.c
rbd.c
replication.c
sheepdog.c
snapshot.c
ssh.c
stream.c
throttle-groups.c
trace-events block: move trace probes into bdrv_co_preadv|pwritev 2017-08-07 09:39:35 +01:00
vdi.c
vhdx-endian.c
vhdx-log.c block/vhdx: check error return of bdrv_truncate() 2017-08-08 14:37:00 +02:00
vhdx.c block/vhdx: check for offset overflow to bdrv_truncate() 2017-08-08 14:37:00 +02:00
vhdx.h
vmdk.c vmdk: Fix error handling/reporting of vmdk_check 2017-08-08 15:19:16 +02:00
vpc.c vpc: Check failure of bdrv_getlength() 2017-08-11 13:23:40 +02:00
vvfat.c
vxhs.c
win32-aio.c
write-threshold.c