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:19 +0100
commit3797412e6a2b65e9c9b832cce8cb32500b920d1d (patch)
tree09d4a834c3b9bfa1883443bfe89f09942a050cd0
parentf1ab0b2e038afc8b03bfa8e04c93a645b167e867 (diff)
downloadopenvswitch-3797412e6a2b65e9c9b832cce8cb32500b920d1d.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 33ea419a7..8e101c50e 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;