Blame SOURCES/kvm-osdep-Retry-SETLK-upon-EINTR.patch

4a2fec
From 3227ce9e3ea004e742f2a3390c426c9699e26a16 Mon Sep 17 00:00:00 2001
4a2fec
From: Fam Zheng <famz@redhat.com>
4a2fec
Date: Fri, 26 Jan 2018 02:07:36 +0100
4a2fec
Subject: [PATCH 5/8] osdep: Retry SETLK upon EINTR
4a2fec
4a2fec
RH-Author: Fam Zheng <famz@redhat.com>
4a2fec
Message-id: <20180126020736.24596-1-famz@redhat.com>
4a2fec
Patchwork-id: 78706
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH] osdep: Retry SETLK upon EINTR
4a2fec
Bugzilla: 1529053
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
4a2fec
We could hit lock failure if there is a signal that makes fcntl return
4a2fec
-1 and errno set to EINTR. In this case we should retry.
4a2fec
4a2fec
Cc: qemu-stable@nongnu.org
4a2fec
Signed-off-by: Fam Zheng <famz@redhat.com>
4a2fec
Reviewed-by: Eric Blake <eblake@redhat.com>
4a2fec
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
(cherry picked from commit f86428a1f4f91a460ed585682af70d3e8c31dc06)
4a2fec
Signed-off-by: Fam Zheng <famz@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 util/osdep.c | 4 +++-
4a2fec
 1 file changed, 3 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/util/osdep.c b/util/osdep.c
4a2fec
index 8358a44..ac7d1b2 100644
4a2fec
--- a/util/osdep.c
4a2fec
+++ b/util/osdep.c
4a2fec
@@ -208,7 +208,9 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
4a2fec
         .l_type   = fl_type,
4a2fec
     };
4a2fec
     qemu_probe_lock_ops();
4a2fec
-    ret = fcntl(fd, fcntl_op_setlk, &fl);
4a2fec
+    do {
4a2fec
+        ret = fcntl(fd, fcntl_op_setlk, &fl);
4a2fec
+    } while (ret == -1 && errno == EINTR);
4a2fec
     return ret == -1 ? -errno : 0;
4a2fec
 }
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec