[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH] osdep: Retry SETLK upon EINTR
From: |
Fam Zheng |
Subject: |
[Qemu-stable] [PATCH] osdep: Retry SETLK upon EINTR |
Date: |
Tue, 26 Dec 2017 14:53:00 +0800 |
We could hit lock failure if there is a signal that makes fcntl return
-1 and errno set to EINTR. In this case we should retry.
Cc: address@hidden
Signed-off-by: Fam Zheng <address@hidden>
---
util/osdep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/osdep.c b/util/osdep.c
index 1231f9f876..a73de0e1ba 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -244,7 +244,9 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t
len, int fl_type)
.l_type = fl_type,
};
qemu_probe_lock_ops();
- ret = fcntl(fd, fcntl_op_setlk, &fl);
+ do {
+ ret = fcntl(fd, fcntl_op_setlk, &fl);
+ } while (ret == -1 && errno == EINTR);
return ret == -1 ? -errno : 0;
}
--
2.14.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-stable] [PATCH] osdep: Retry SETLK upon EINTR,
Fam Zheng <=