]> git.ipfire.org Git - thirdparty/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)
committerCole Robinson <crobinso@redhat.com>
Fri, 15 Jun 2012 14:58:27 +0000 (10:58 -0400)
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)

src/qemu/qemu_migration.c

index 8fbf7b4a1f2247efc8d5f9a134597b6940ba6886..56d4ecfb98034918226ac8cc544d82d4be9f6e73 100644 (file)
@@ -1505,8 +1505,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);