diff --git a/buffered_file.c b/buffered_file.c index a79264f451312884e79fcf9949bdb727ce34fbff..1836e7e2421d655835acf33889744ec3c51e7c54 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -230,8 +230,10 @@ static void buffered_rate_tick(void *opaque) { QEMUFileBuffered *s = opaque; - if (s->has_error) + if (s->has_error) { + buffered_close(s); return; + } qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100); diff --git a/migration.c b/migration.c index a160462dfa68de92b71683113319c27a09a8bdcc..468d51749f4cc190662e2741ebfaf27b3aab4719 100644 --- a/migration.c +++ b/migration.c @@ -316,8 +316,14 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) if (ret == -1) ret = -(s->get_error(s)); - if (ret == -EAGAIN) + if (ret == -EAGAIN) { qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); + } else if (ret < 0) { + if (s->mon) { + monitor_resume(s->mon); + } + s->state = MIG_STATE_ERROR; + } return ret; }