qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT e19252d] migrate_fd_close: delete associated io-h


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT e19252d] migrate_fd_close: delete associated io-handlerbefore closing the fd
Date: Mon, 15 Jun 2009 02:26:43 -0000

From: Uri Lublin <address@hidden>

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.

Signed-off-by: Uri Lublin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/migration.c b/migration.c
index 401383c..57f2a52 100644
--- a/migration.c
+++ b/migration.c
@@ -301,5 +301,7 @@ 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);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]