!977 [sync] PR-971: sync fix: when errno is ENOTCONN, ignore it

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-09-14 02:14:49 +00:00 committed by Gitee
commit f72e4fcdbe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 122 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 878bd892608e312276945a57430c86909cefb459 Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Fri, 30 Aug 2024 16:15:03 +0800
Subject: [PATCH] tools: fix script generate patchname wrong
---
tools/sync-gazelle-src.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/sync-gazelle-src.sh b/tools/sync-gazelle-src.sh
index 142e770..ccfa8eb 100644
--- a/tools/sync-gazelle-src.sh
+++ b/tools/sync-gazelle-src.sh
@@ -65,14 +65,14 @@ for commitid in ${COMMIT_ID};do
fi
#get patchnum from spec file.
- patchnum=$(grep -o "Patch[0-9]\+" *.spec | tail -n 1 | awk -Fh '{print $2}')
+ patchnum=$(grep -o "Patch[0-9]\+" *.spec | tail -n 1 | awk -Fh '{print $2}' | awk '{print $1 - 9000}')
if [ -z $patchnum ];then
#there is no patch in spec file. get patch by conunt patches in dir.
patchnum=$(ls ./*.patch | wc -l)
- let Patchnum=9000+$patchnum
- patchnum=$(printf "%04d\n" $patchnum)
fi
let patchnum+=1
+ let Patchnum=9000+$patchnum
+ patchnum=$(printf "%04d\n" $patchnum)
new_patchname=$(echo $patchname | sed -e "s/^0001-/${patchnum}-/g")
echo $new_patchname
--
2.33.0

View File

@ -0,0 +1,81 @@
From 015eea5899cfea961247686d711a67917cb7a7b9 Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Thu, 5 Sep 2024 14:37:07 +0800
Subject: [PATCH] fix: when errno is ENOTCONN, ignore it
---
src/lstack/core/lstack_protocol_stack.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index ba90d86..49b3ec8 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -559,18 +559,18 @@ int32_t stack_group_init_mempool(void)
LSTACK_LOG(INFO, LSTACK,
"config::num_cpu=%d num_process=%d \n", cfg_params->num_cpu, cfg_params->num_process);
-
+
for (int cpu_idx = 0; cpu_idx < cfg_params->num_queue; cpu_idx++) {
cpu_id = cfg_params->cpus[cpu_idx];
numa_id = numa_node_of_cpu(cpu_id);
-
+
for (int process_idx = 0; process_idx < cfg_params->num_process; process_idx++) {
queue_id = cpu_idx * cfg_params->num_process + process_idx;
if (queue_id >= PROTOCOL_STACK_MAX) {
LSTACK_LOG(ERR, LSTACK, "index is over\n");
return -1;
}
-
+
total_mbufs = (total_conn_mbufs / cfg_params->num_queue) + total_nic_mbufs + MBUFPOOL_RESERVE_NUM;
rxtx_mbuf = create_pktmbuf_mempool("rxtx_mbuf", total_mbufs, RXTX_CACHE_SZ, queue_id, numa_id);
if (rxtx_mbuf == NULL) {
@@ -578,7 +578,7 @@ int32_t stack_group_init_mempool(void)
cpu_id, numa_id, queue_id);
return -1;
}
-
+
get_protocol_stack_group()->total_rxtx_pktmbuf_pool[queue_id] = rxtx_mbuf;
}
}
@@ -723,13 +723,13 @@ void stack_close(struct rpc_msg *msg)
int32_t fd = msg->args[MSG_ARG_0].i;
struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
struct lwip_sock *sock = lwip_get_socket(fd);
-
+
if (sock && __atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) > 0) {
msg->recall_flag = 1;
rpc_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
return;
}
-
+
msg->result = lwip_close(fd);
if (msg->result != 0) {
LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d failed %ld\n", get_stack_tid(), msg->args[MSG_ARG_0].i, msg->result);
@@ -750,7 +750,7 @@ void stack_shutdown(struct rpc_msg *msg)
}
msg->result = lwip_shutdown(fd, how);
- if (msg->result != 0) {
+ if (msg->result != 0 && errno != ENOTCONN) {
LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d fail %ld\n", get_stack_tid(), fd, msg->result);
}
@@ -935,7 +935,7 @@ void stack_udp_send(struct rpc_msg *msg)
rpc_call_replenish(&stack->rpc_queue, sock);
return;
}
-
+
__sync_fetch_and_sub(&sock->call_num, 1);
return;
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 59
Release: 60
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -266,6 +266,8 @@ Patch9246: 0246-fix-mbuf_total-calculation-error.patch
Patch9247: 0247-cfg-modify-maximum-tcp_conn_count-to-2w.patch
Patch9248: 0248-tools-fix-sync-patch-script-date-wrong-and-update-th.patch
Patch9249: 0249-epoll-fix-wild-pointer-detected-by-cooddy.patch
Patch9250: 0250-tools-fix-script-generate-patchname-wrong.patch
Patch9251: 0251-fix-when-errno-is-ENOTCONN-ignore-it.patch
%description
%{name} is a high performance user-mode stack.
@ -307,6 +309,10 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Fri Sep 06 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-60
- fix: when errno is ENOTCONN, ignore it
- tools: fix script generate patchname wrong
* Fri Aug 30 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-59
- epoll: fix wild pointer detected by cooddy
- tools: fix sync patch script date wrong and update the way get patchnum