From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBXAm-0004In-43 for qemu-devel@nongnu.org; Tue, 02 Jun 2009 12:49:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBXAh-00047o-7z for qemu-devel@nongnu.org; Tue, 02 Jun 2009 12:49:11 -0400 Received: from [199.232.76.173] (port=45283 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBXAh-00047W-3T for qemu-devel@nongnu.org; Tue, 02 Jun 2009 12:49:07 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52202) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MBXAg-0004tk-4K for qemu-devel@nongnu.org; Tue, 02 Jun 2009 12:49:06 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n52Gn4TE010900 for ; Tue, 2 Jun 2009 12:49:04 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n52Gn3MZ025587 for ; Tue, 2 Jun 2009 12:49:03 -0400 Received: from [10.35.1.187] (dhcp-1-187.tlv.redhat.com [10.35.1.187]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n52Gn2Pu006835 for ; Tue, 2 Jun 2009 12:49:03 -0400 Message-ID: <4A2557FE.8040703@redhat.com> Date: Tue, 02 Jun 2009 19:49:02 +0300 From: Uri Lublin MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000304050001020103010805" Subject: [Qemu-devel] [PATCH] exec-migration: handle EINTR in popen_get_buffer() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel This is a multi-part message in MIME format. --------------000304050001020103010805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, The attached patch fix occasional failures of incoming exec migrations. Patch based on qemu-kvm.git. Uri. --------------000304050001020103010805 Content-Type: text/x-patch; name="0001-exec-migration-handle-EINTR-in-popen_get_buffer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-exec-migration-handle-EINTR-in-popen_get_buffer.patch" >>From 0003cebfd2afdf03e2f2cff599691952950a05ce Mon Sep 17 00:00:00 2001 From: Uri Lublin 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. Signed-off-by: Uri Lublin --- savevm.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/savevm.c b/savevm.c index 68ffd03..f53de43 100644 --- a/savevm.c +++ b/savevm.c @@ -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) -- 1.6.2.2 --------------000304050001020103010805--