Skip to contentSkip to conversation

migrate.c: migrate_fd_put_buffer(): Do not busyloop: stop writing if EWOULDBLOCK

PATCH RESEND New Uri Lublin 1 participant 1 message Feb 10, 2009

lore
Share & tools
lore

Uri Lublin

author
#0 lore raw

PATCH RESEND 1/2 migrate.c: migrate_fd_put_buffer(): Do not busyloop: stop writing if EWOULDBLOCK

Theoretically the migration code is non-blocking, designed for live migration.

Practically migrate_fd_put_buffer busy-loops trying to write. That's since on many machines EWOULDBLOCK==EAGAIN (e.g. look in <linux>/include/asm-generic/errno.h).
Busy looping is much worse then blocking (in case a write actually blocks).

Fixed by removing "(s->get_error(s)) == EWOULDBLOCK)" from the while condition.

---
 migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
migration.c +1 -1
index 0ef777a..e8bafa6 100644
@@ -168,7 +168,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
 
     do {
         ret = s->write(s, data, size);
-    } while (ret == -1 && ((s->get_error(s)) == EINTR || (s->get_error(s)) == EWOULDBLOCK));
+    } while (ret == -1 && s->get_error(s) == EINTR);
 
     if (ret == -1)
         ret = -(s->get_error(s));
Signature · 1 line
1.6.0.6