block migration: do not submit multiple AIOs for same sector
commit33656af70230d5ccebe29e2f3bee38afe17db9b2
authorMarcelo Tosatti <mtosatti@redhat.com>
Mon, 8 Nov 2010 19:02:56 +0000 (8 17:02 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Sun, 21 Nov 2010 15:16:56 +0000 (21 09:16 -0600)
treeaa8ff2f779a32f571a075694e4f06d46a1cd518f
parent4dcafbb1eba2ee201ec86027982659b669f99c70
block migration: do not submit multiple AIOs for same sector

Block migration can submit multiple AIO reads for the same sector/chunk, but
completion of such reads can happen out of order:

migration               guest
- get_dirty(N)
- aio_read(N)
- clear_dirty(N)
                        write(N)
                        set_dirty(N)
- get_dirty(N)
- aio_read(N)

If the first aio_read completes after the second, stale data will be
migrated to the destination.

Fix by not allowing multiple AIOs inflight for the same sector.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block-migration.c