dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0049-migration-Clear-fd-also-in-error-cases.patch

Justin M. Forbes 4382ef
From a0591dc91ad795ffb47476b37730e46977a6be36 Mon Sep 17 00:00:00 2001
Justin M. Forbes 4382ef
From: Juan Quintela <quintela@redhat.com>
Justin M. Forbes 4382ef
Date: Tue, 9 Mar 2010 23:58:50 +0100
Justin M. Forbes 4382ef
Subject: [PATCH] migration: Clear fd also in error cases
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
Not clearing the fd and closing the file makes qemu spin using 100%CPU
Justin M. Forbes 4382ef
after incoming migration error.
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
See for instance bug:
Justin M. Forbes 4382ef
https://bugzilla.redhat.com/show_bug.cgi?id=518032
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
Signed-off-by: Juan Quintela <quintela@trasno.org>
Justin M. Forbes 4382ef
---
Justin M. Forbes 4382ef
 migration-exec.c |    3 +--
Justin M. Forbes 4382ef
 migration-fd.c   |    3 +--
Justin M. Forbes 4382ef
 migration-tcp.c  |    5 ++---
Justin M. Forbes 4382ef
 migration-unix.c |    5 ++---
Justin M. Forbes 4382ef
 4 files changed, 6 insertions(+), 10 deletions(-)
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
diff --git a/migration-exec.c b/migration-exec.c
Justin M. Forbes 4382ef
index 87f645b..e57a55d 100644
Justin M. Forbes 4382ef
--- a/migration-exec.c
Justin M. Forbes 4382ef
+++ b/migration-exec.c
Justin M. Forbes 4382ef
@@ -120,12 +120,11 @@ static void exec_accept_incoming_migration(void *opaque)
Justin M. Forbes 4382ef
     }
Justin M. Forbes 4382ef
     qemu_announce_self();
Justin M. Forbes 4382ef
     dprintf("successfully loaded vm state\n");
Justin M. Forbes 4382ef
-    /* we've successfully migrated, close the fd */
Justin M. Forbes 4382ef
-    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
     if (autostart)
Justin M. Forbes 4382ef
         vm_start();
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
 err:
Justin M. Forbes 4382ef
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
     qemu_fclose(f);
Justin M. Forbes 4382ef
 }
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
diff --git a/migration-fd.c b/migration-fd.c
Justin M. Forbes 4382ef
index ef7edbc..7325d13 100644
Justin M. Forbes 4382ef
--- a/migration-fd.c
Justin M. Forbes 4382ef
+++ b/migration-fd.c
Justin M. Forbes 4382ef
@@ -113,12 +113,11 @@ static void fd_accept_incoming_migration(void *opaque)
Justin M. Forbes 4382ef
     }
Justin M. Forbes 4382ef
     qemu_announce_self();
Justin M. Forbes 4382ef
     dprintf("successfully loaded vm state\n");
Justin M. Forbes 4382ef
-    /* we've successfully migrated, close the fd */
Justin M. Forbes 4382ef
-    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
     if (autostart)
Justin M. Forbes 4382ef
         vm_start();
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
 err:
Justin M. Forbes 4382ef
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
     qemu_fclose(f);
Justin M. Forbes 4382ef
 }
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
diff --git a/migration-tcp.c b/migration-tcp.c
Justin M. Forbes 4382ef
index 2cfa8cb..c328e73 100644
Justin M. Forbes 4382ef
--- a/migration-tcp.c
Justin M. Forbes 4382ef
+++ b/migration-tcp.c
Justin M. Forbes 4382ef
@@ -170,15 +170,14 @@ static void tcp_accept_incoming_migration(void *opaque)
Justin M. Forbes 4382ef
     qemu_announce_self();
Justin M. Forbes 4382ef
     dprintf("successfully loaded vm state\n");
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
-    /* we've successfully migrated, close the server socket */
Justin M. Forbes 4382ef
-    qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
-    close(s);
Justin M. Forbes 4382ef
     if (autostart)
Justin M. Forbes 4382ef
         vm_start();
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
 out_fopen:
Justin M. Forbes 4382ef
     qemu_fclose(f);
Justin M. Forbes 4382ef
 out:
Justin M. Forbes 4382ef
+    qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
+    close(s);
Justin M. Forbes 4382ef
     close(c);
Justin M. Forbes 4382ef
 }
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
diff --git a/migration-unix.c b/migration-unix.c
Justin M. Forbes 4382ef
index a141dbb..9685c4b 100644
Justin M. Forbes 4382ef
--- a/migration-unix.c
Justin M. Forbes 4382ef
+++ b/migration-unix.c
Justin M. Forbes 4382ef
@@ -176,13 +176,12 @@ static void unix_accept_incoming_migration(void *opaque)
Justin M. Forbes 4382ef
     qemu_announce_self();
Justin M. Forbes 4382ef
     dprintf("successfully loaded vm state\n");
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
-    /* we've successfully migrated, close the server socket */
Justin M. Forbes 4382ef
-    qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
-    close(s);
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
 out_fopen:
Justin M. Forbes 4382ef
     qemu_fclose(f);
Justin M. Forbes 4382ef
 out:
Justin M. Forbes 4382ef
+    qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
Justin M. Forbes 4382ef
+    close(s);
Justin M. Forbes 4382ef
     close(c);
Justin M. Forbes 4382ef
 }
Justin M. Forbes 4382ef
Justin M. Forbes 4382ef
-- 
Justin M. Forbes 4382ef
1.6.6.1
Justin M. Forbes 4382ef