]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: avoid closing fd more than once
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 30 May 2012 09:20:44 +0000 (17:20 +0800)
committerEric Blake <eblake@redhat.com>
Thu, 31 May 2012 03:41:46 +0000 (21:41 -0600)
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).

src/qemu/qemu_migration.c

index 6f428234569bbf5e36a87318f71903e65814c1b4..b58380b7307d18bd69c5a9e7c2d261fd761565b6 100644 (file)
@@ -1910,8 +1910,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);