summaryrefslogtreecommitdiff
path: root/lib
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:02:20 +0100
commitb0d9a1efccb931d3eb71661b1506c2bdde58d4d9 (patch)
tree4835e0e47d008d5352b01dfab6d5a4ff1d05d313 /lib
parent71e5669af6bf1d8f7ba0afbea24ce811d23e7d2e (diff)
downloadopenvswitch-b0d9a1efccb931d3eb71661b1506c2bdde58d4d9.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>
Diffstat (limited to 'lib')
-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;