1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0107-fix-stack-wakeup-node-del.patch 2.97 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2022-10-08 22:27 . adapt ceph client
From ef98d32ed9dbde08412c8d4587bfeb7a6e75ec7c Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sun, 9 Oct 2022 20:21:40 +0800
Subject: [PATCH] fix stack wakeup node del
---
src/lstack/api/lstack_epoll.c | 4 ++--
src/lstack/core/lstack_lwip.c | 2 +-
src/lstack/core/lstack_protocol_stack.c | 6 ++++++
src/lstack/core/lstack_stack_stat.c | 1 +
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 6ac245c..dcd58e7 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -164,8 +164,8 @@ int32_t lstack_epoll_close(int32_t fd)
}
if (sock->wakeup) {
- if (sock->stack) {
- unregister_wakeup(sock->stack, sock->wakeup);
+ if (sock->wakeup->bind_stack) {
+ unregister_wakeup(sock->wakeup->bind_stack, sock->wakeup);
}
posix_api->close_fn(sock->wakeup->eventfd);
pthread_spin_destroy(&sock->wakeup->event_list_lock);
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 8c1df26..4fbaed1 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -486,7 +486,7 @@ static int32_t check_msg_vaild(const struct msghdr *message)
}
for (int32_t i = 0; i < message->msg_iovlen; i++) {
- if ((message->msg_iov[i].iov_base == NULL) || ((ssize_t)message->msg_iov[i].iov_len <= 0) ||
+ if ((message->msg_iov[i].iov_base == NULL) || ((ssize_t)message->msg_iov[i].iov_len < 0) ||
((size_t)(ssize_t)message->msg_iov[i].iov_len != message->msg_iov[i].iov_len) ||
((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) <= 0)) {
GAZELLE_RETURN(EINVAL);
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index fbeca62..8283a41 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -355,6 +355,10 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
static void wakeup_stack_wait(struct protocol_stack *stack)
{
+ if (pthread_spin_trylock(&stack->wakeup_list_lock)) {
+ return;
+ }
+
struct wakeup_poll *node = stack->wakeup_list;
while (node) {
if (node->have_event) {
@@ -363,6 +367,8 @@ static void wakeup_stack_wait(struct protocol_stack *stack)
}
node = node->next;
}
+
+ pthread_spin_unlock(&stack->wakeup_list_lock);
}
static void* gazelle_stack_thread(void *arg)
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
index b32f082..c011aed 100644
--- a/src/lstack/core/lstack_stack_stat.c
+++ b/src/lstack/core/lstack_stack_stat.c
@@ -124,6 +124,7 @@ void unregister_wakeup(struct protocol_stack *stack, struct wakeup_poll *wakeup)
} else {
stack->wakeup_list = node->next;
}
+ node->next = NULL;
pthread_spin_unlock(&stack->wakeup_list_lock);
}
--
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