On Mon, Feb 11, 2013 at 11:16:09AM +0100, Paolo Bonzini wrote: > Il 09/02/2013 17:44, Stefan Hajnoczi ha scritto: > > bdrv_co_io_em(), bdrv_co_flush(), and bdrv_co_discard() yield the > > coroutine when waiting for aio to complete. They do not check that the > > request has actually finished. > > > > In simple cases this works, but it returns early when we get spurious > > wake-ups due to qemu_coroutine_enter() being called from other sources. > > One such example is block-migration.c:process_incoming_migration(). > > > > This patch fixes a segfault on incoming block migration. > > > > Reported-by: David Pravec <david.pra...@nethost.cz> > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > > I would prefer to have ret initialized to -EINPROGRESS, but since we're > close to release it's easier this way.
I did it that way first but then I felt a little paranoid about using the return value space as the sentinel. Granted, most block functions will never return -EINPROGRESS but I think a separate bool done variable is cleaner. Stefan