Skip to content
Snippets Groups Projects
Commit e19252d3 authored by Uri Lublin's avatar Uri Lublin Committed by Anthony Liguori
Browse files

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: default avatarUri Lublin <uril@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 8a67ec4d
No related branches found
No related tags found
No related merge requests found
...@@ -301,5 +301,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque) ...@@ -301,5 +301,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque)
int migrate_fd_close(void *opaque) int migrate_fd_close(void *opaque)
{ {
FdMigrationState *s = opaque; FdMigrationState *s = opaque;
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
return s->close(s); return s->close(s);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment