summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Mancang <liangmc1@chinatelecom.cn>2023-02-21 17:19:01 +0800
committerIlya Maximets <i.maximets@ovn.org>2023-02-21 21:03:18 +0100
commitcb4eecd01489b32edd9f71f4b5ec56cc2ca22590 (patch)
tree8cc4370909a1e79cfab29e8234e12bf1d9c4afd7
parent372e1a835a70b8db3194ac86c22c7cd9a7534f8c (diff)
downloadopenvswitch-cb4eecd01489b32edd9f71f4b5ec56cc2ca22590.tar.gz
conntrack: Fix conntrack_clean may access the same exp_list each time.
when a exp_list contains more than the clean_end's number of nodes, and these nodes will not expire immediately. Then, every times we call conntrack_clean, it use the same next_sweep to get exp_list. Actually, we should add i every times after we call ct_sweep. Fixes: 3d9c1b855a5f ("conntrack: Replace timeout based expiration lists with rculists.") Acked-by: Paolo Valerio <pvalerio@redhat.com> Signed-off-by: Liang Mancang <liangmc1@chinatelecom.cn> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/conntrack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/conntrack.c b/lib/conntrack.c
index 524670e45..8cf7779c6 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -1512,12 +1512,12 @@ conntrack_clean(struct conntrack *ct, long long now)
clean_end = n_conn_limit / 64;
for (i = ct->next_sweep; i < N_EXP_LISTS; i++) {
- count += ct_sweep(ct, &ct->exp_lists[i], now);
-
if (count > clean_end) {
next_wakeup = 0;
break;
}
+
+ count += ct_sweep(ct, &ct->exp_lists[i], now);
}
ct->next_sweep = (i < N_EXP_LISTS) ? i : 0;