summaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2013-02-11 17:01:45 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-11 13:22:52 -0600
commitd7cd369402191814a1bb339a730f3af411e9682f (patch)
tree7d073bdab810935815661826e533b49f346f865d /migration.c
parentd0bce760e04b1658a3b4ac95be2839ae20fd86db (diff)
downloadqemu-d7cd369402191814a1bb339a730f3af411e9682f.tar.gz
migration: restrict scope of incoming fd read handler
The incoming migration is processed in a coroutine and uses an fd read handler to enter the yielded coroutine when data becomes available. The read handler was set too broadly, so that spurious coroutine entries were be triggered if other coroutine users yielded (like the block layer's bdrv_write() function). Install the fd read only only when yielding for more data to become available. This prevents spurious coroutine entries which break code that assumes only a specific set of places can re-enter the coroutine. This patch fixes crashes in block/raw-posix.c that are triggered with "migrate -b" when qiov becomes a dangling pointer due to a spurious coroutine entry that frees qiov early. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1360598505-5512-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/migration.c b/migration.c
index c4589b16f8..b1ebb01145 100644
--- a/migration.c
+++ b/migration.c
@@ -95,7 +95,6 @@ static void process_incoming_migration_co(void *opaque)
int ret;
ret = qemu_loadvm_state(f);
- qemu_set_fd_handler(qemu_get_fd(f), NULL, NULL, NULL);
qemu_fclose(f);
if (ret < 0) {
fprintf(stderr, "load of migration failed\n");
@@ -115,12 +114,6 @@ static void process_incoming_migration_co(void *opaque)
}
}
-static void enter_migration_coroutine(void *opaque)
-{
- Coroutine *co = opaque;
- qemu_coroutine_enter(co, NULL);
-}
-
void process_incoming_migration(QEMUFile *f)
{
Coroutine *co = qemu_coroutine_create(process_incoming_migration_co);
@@ -128,7 +121,6 @@ void process_incoming_migration(QEMUFile *f)
assert(fd != -1);
socket_set_nonblock(fd);
- qemu_set_fd_handler(fd, enter_migration_coroutine, NULL, co);
qemu_coroutine_enter(co, f);
}