Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 491

kvm-83-164.el5_5.30.src.rpm

From d1b6334db7565544a8e395940d1cb8c568339648 Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Mon, 8 Jun 2009 14:29:57 +0300
Subject: [PATCH 1/5] migrate_fd_close: delete associated io-handler before closing the fd

It may happen that the io-handler is still registered. That causes
select() to return with EBADF, not calling handlers for other fds.

The io-handler would be registered when (on the source) the whole state
was written but not yet flushed. For example when using QEMUFileBuffered,
(tcp-migration) there may be data left in a buffer waiting to be transferred.
In such a case buffered_close() calls buffered_flush() which calls
migrate_fd_put_buffer, which may, upon EAGAIN, register migrate_fd_put_notify
as a handler.

BZ 503713

Signed-off-by: Uri Lublin <uril@redhat.com>
Message-Id: <1244460597-13647-1-git-send-email-uril@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Upstream-status: pending
Acked-by: Dor Laor <dlaor@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Mark McLoughlin <markmc@redhat.com>
Bugzilla: 504237
---
 qemu/migration.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu/migration.c b/qemu/migration.c
index 415d693..c748444 100644
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -322,6 +322,8 @@ void migrate_fd_wait_for_unfreeze(void *opaque)
 int migrate_fd_close(void *opaque)
 {
     FdMigrationState *s = opaque;
+
+    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     return s->close(s);
 }
 
-- 
1.6.3.rc4.29.g8146