diff mbox

[09/11] migration: don't "write" when migration is not active

Message ID 28d7c0af10d91b0428ef81f4e48d3e641d3dc99c.1316781876.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Sept. 23, 2011, 12:50 p.m. UTC
If migration is not active, just ignore writes.

[Based on Daniel Berrange suggestion]

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/migration.c b/migration.c
index 0b284ff..755b96b 100644
--- a/migration.c
+++ b/migration.c
@@ -323,6 +323,10 @@  ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
     FdMigrationState *s = opaque;
     ssize_t ret;

+    if (s->state != MIG_STATE_ACTIVE) {
+        return -EIO;
+    }
+
     do {
         ret = s->write(s, data, size);
     } while (ret == -1 && ((s->get_error(s)) == EINTR));