1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0041-exit-lstack-process-after-ltran-instance-logout.patch 2.42 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2022-07-07 21:58 . backport upstream patches:
From 336703252c327d82f49d40f79b1d1e4e65a9281e Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Tue, 19 Apr 2022 19:49:06 +0800
Subject: [PATCH 02/18] exit lstack process after ltran instance logout
close fd is to notify ltran to execute the lstack instance logout.
200ms is an empirical value of instance logout.
---
src/lstack/api/lstack_signal.c | 4 +++-
src/lstack/core/lstack_control_plane.c | 9 +++++++++
src/lstack/include/lstack_control_plane.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/lstack/api/lstack_signal.c b/src/lstack/api/lstack_signal.c
index f4763e8..87cbdda 100644
--- a/src/lstack/api/lstack_signal.c
+++ b/src/lstack/api/lstack_signal.c
@@ -19,8 +19,9 @@
#include <lwip/posix_api.h>
#include "lstack_log.h"
+#include "lstack_control_plane.h"
-static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL };
+static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGKILL};
#define HIJACK_SIGNAL_COUNT (sizeof(g_hijack_signal) / sizeof(g_hijack_signal[0]))
#define BACKTRACE_SIZE 64
static void dump_stack(void)
@@ -54,6 +55,7 @@ static inline bool match_hijack_signal(int sig)
static void lstack_sig_default_handler(int sig)
{
LSTACK_LOG(ERR, LSTACK, "lstack dumped,caught signal:%d\n", sig);
+ control_fd_close();
dump_stack();
lwip_exit();
(void)kill(getpid(), sig);
diff --git a/src/lstack/core/lstack_control_plane.c b/src/lstack/core/lstack_control_plane.c
index c782d51..01b2ff0 100644
--- a/src/lstack/core/lstack_control_plane.c
+++ b/src/lstack/core/lstack_control_plane.c
@@ -446,6 +446,15 @@ int32_t client_reg_thrd_ring(void)
return 0;
}
+void control_fd_close(void)
+{
+ if (g_data_fd != 0) {
+ close(g_data_fd);
+ /* 200ms: wait ltran instance logout */
+ rte_delay_ms(200);
+ }
+}
+
int32_t control_init_client(bool is_reconnect)
{
int32_t ret;
diff --git a/src/lstack/include/lstack_control_plane.h b/src/lstack/include/lstack_control_plane.h
index 0af891a..1fa84e6 100644
--- a/src/lstack/include/lstack_control_plane.h
+++ b/src/lstack/include/lstack_control_plane.h
@@ -32,5 +32,6 @@ void control_server_thread(void *arg);
bool get_register_state(void);
void thread_register_phase1(struct rpc_msg *msg);
void thread_register_phase2(struct rpc_msg *msg);
+void control_fd_close(void);
#endif /* GAZELLE_CONTROL_PLANE_H */
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fantaotao1/gazelle.git
git@gitee.com:fantaotao1/gazelle.git
fantaotao1
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385