Skip to contentSkip to conversation

exec-migration: handle EINTR in popen_get_buffer()

PATCH New Uri Lublin 1 participant 1 message Jun 2, 2009

lore
Share & tools
lore

Uri Lublin

author
#0 lore raw

PATCH 1/1 exec-migration: handle EINTR in popen_get_buffer()

Hello,

The attached patch fix occasional failures of incoming exec migrations.

Patch based on qemu-kvm.git.

Uri.

Quoted 1 line

From 0003cebfd2afdf03e2f2cff599691952950a05ce Mon Sep 17 00:00:00 2001

From: Uri Lublin <[email protected]>
Date: Tue, 2 Jun 2009 17:09:57 +0300
Subject: [PATCH] exec-migration: handle EINTR in popen_get_buffer()

Upon interrupt, fread returns with no data, and the (incoming exec) migration fails.

Fix by retrying on such a case.

---
 savevm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
savevm.c +6 -1
index 68ffd03..f53de43 100644
@@ -215,7 +215,12 @@ static int popen_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int s
 static int popen_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
 {
     QEMUFilePopen *s = opaque;
-    return fread(buf, 1, size, s->popen_file);
+    int bytes;
+
+    do {
+        bytes = fread(buf, 1, size, s->popen_file);
+    } while ((bytes == 0) && (errno == EINTR));
+    return bytes;
 }
 
 static int popen_close(void *opaque)
Signature · 1 line
1.6.2.2