migrate_fd_close: delete associated io-handler before closing the fd
commite19252d32c45e92c919109ec32616382eb2afe6b
authorUri Lublin <uril@redhat.com>
Mon, 8 Jun 2009 11:28:01 +0000 (8 14:28 +0300)
committerAnthony Liguori <aliguori@us.ibm.com>
Sun, 14 Jun 2009 00:19:25 +0000 (13 19:19 -0500)
treede5bbeefedbe56feb5f3438b56e1bf2911ce5b5c
parent8a67ec4d84f7db9add9a0b017a968d340fbfb807
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.

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration.c