1 Star 0 Fork 8

huajingyun/fence-virt

forked from src-openEuler/fence-virt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bz1766993-fence_virtd-2-return-mainloop-on-interrupt.patch 2.46 KB
一键复制 编辑 原始数据 按行查看 历史
jiangxinyu 提交于 2022-02-28 16:25 . Fix fence_virtd.service stop failed
From 958c0035aa6a69149c1a0fa218863c26e755d9e6 Mon Sep 17 00:00:00 2001
From: Ryan McCabe <rmccabe@redhat.com>
Date: Fri, 19 Jan 2018 11:04:22 -0500
Subject: [PATCH] fence_virtd: Return control to main loop on select
interruption
Return control to the dispatch loop if select is interrupted by a
signal. The code that retried the select without breaking out of the
dispatch loop caused the daemon to not be able to be killed cleanly.
Resolves: https://github.com/ClusterLabs/fence-virt/issues/10
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
server/mcast.c | 9 +++++++--
server/serial.c | 9 ++++++---
server/tcp.c | 9 +++++++--
4 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/server/mcast.c b/server/mcast.c
index 0336823..e103675 100644
--- a/server/mcast.c
+++ b/server/mcast.c
@@ -350,9 +350,14 @@ mcast_dispatch(listener_context_t c, struct timeval *timeout)
FD_ZERO(&rfds);
FD_SET(info->mc_sock, &rfds);
- n = _select_retry((info->mc_sock)+1, &rfds, NULL, NULL, timeout);
- if (n <= 0)
+ n = select((info->mc_sock)+1, &rfds, NULL, NULL, timeout);
+ if (n <= 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ n = 0;
+ else
+ dbg_printf(2, "select: %s\n", strerror(errno));
return n;
+ }
slen = sizeof(sin);
len = recvfrom(info->mc_sock, &data, sizeof(data), 0,
diff --git a/server/serial.c b/server/serial.c
index 70eb22b..23d143d 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -272,9 +272,12 @@ serial_dispatch(listener_context_t c, struct timeval *timeout)
if (info->wake_fd > max)
max = info->wake_fd;
- n = _select_retry(max+1, &rfds, NULL, NULL, timeout);
- if (n < 0) {
- dbg_printf(2, "select: %s\n", strerror(errno));
+ n = select(max+1, &rfds, NULL, NULL, timeout);
+ if (n <= 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ n = 0;
+ else
+ dbg_printf(2, "select: %s\n", strerror(errno));
return n;
}
diff --git a/server/tcp.c b/server/tcp.c
index 09366b7..bbd347e 100644
--- a/server/tcp.c
+++ b/server/tcp.c
@@ -278,9 +278,14 @@ tcp_dispatch(listener_context_t c, struct timeval *timeout)
FD_ZERO(&rfds);
FD_SET(info->listen_sock, &rfds);
- n = _select_retry(info->listen_sock + 1, &rfds, NULL, NULL, timeout);
- if (n <= 0)
+ n = select(info->listen_sock + 1, &rfds, NULL, NULL, timeout);
+ if (n <= 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ n = 0;
+ else
+ dbg_printf(2, "select: %s\n", strerror(errno));
return n;
+ }
client_fd = accept(info->listen_sock, NULL, NULL);
if (client_fd < 0) {
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huajingyun/fence-virt.git
git@gitee.com:huajingyun/fence-virt.git
huajingyun
fence-virt
fence-virt
master

搜索帮助