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