From: Wen Congyang Date: Wed, 30 May 2012 09:20:44 +0000 (+0800) Subject: qemu: avoid closing fd more than once X-Git-Tag: v0.9.11.4~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e1e20c3a76a2b97bf20a1a82d416618dc54ee80;p=thirdparty%2Flibvirt.git qemu: avoid closing fd more than once If we migrate to fd, spec->fwdType is not MIGRATION_FWD_DIRECT, we will close spec->dest.fd.local in qemuMigrationRun(). So we should set spec->dest.fd.local to -1 in qemuMigrationRun(). Bug present since 0.9.5 (commit 326176179). (cherry picked from commit b19c236d69278c967d2d8b4aae97ac76213f1c10) --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4ebebcf073..78a4fb6376 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1909,8 +1909,10 @@ qemuMigrationRun(struct qemud_driver *driver, break; case MIGRATION_DEST_FD: - if (spec->fwdType != MIGRATION_FWD_DIRECT) + if (spec->fwdType != MIGRATION_FWD_DIRECT) { fd = spec->dest.fd.local; + spec->dest.fd.local = -1; + } ret = qemuMonitorMigrateToFd(priv->mon, migrate_flags, spec->dest.fd.qemu); VIR_FORCE_CLOSE(spec->dest.fd.qemu);