From: Julian Anastasov <ja@ssi.bg>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, horms@kernel.org, fw@strlen.de
Subject: Re: [PATCH net 02/15] ipvs: wait grace period while reusing dest from trash
Date: Tue, 3 Nov 2026 16:18:05 +0200 (EET) [thread overview]
Message-ID: <15ccbaa8-170c-d920-866f-ece97d6def13@ssi.bg> (raw)
In-Reply-To: <20261103140308.591690-4-pablo@netfilter.org>
Hello,
On Tue, 3 Nov 2026, Pablo Neira Ayuso wrote:
> From: Darong Lu <zzyy19904204639@163.com>
>
> Darong Lu and the VEGA team report a problem with the TWOS scheduler
> that manifests as a loop while traversing the list of destinations. The
> problem occurs if destinations are removed and re-added through the
> destination trash before an RCU grace period has elapsed. As destinations
> are re-added to a new service, CPUs traversing the old destination list
> may never reach the old list head and fail to terminate.
>
> As the problem is not specific to the TWOS scheduler, use a general
> solution. Jiayuan Chen provided an initial solution based on
> get_state_synchronize_rcu() and cond_synchronize_rcu(), where the grace
> period cookie is saved after a destination is unlinked and moved into the
> destination trash. cond_synchronize_rcu() then ensures the grace period
> before the destination is reused.
>
> Use a temporary list for destinations removed together from a service or
> during a flush. A single get_state_synchronize_rcu() call records the
> cookie for all destinations before the temporary list is spliced into the
> public destination trash. This also limits destination-trash locking to
> one acquisition for bulk removal.
>
> Destination edits that remove and re-add an entry to the real-server hash
> table use the same grace-period mechanism. Destinations returned to the
> trash after an estimator failure are put back without recording a new
> cookie.
>
> Fixes: ceec4c381681 ("ipvs: convert services to rcu")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Reported-by: Darong Lu <zzyy19904204639@163.com>
> Link: https://patch.msgid.link/cover.1789117690.git.zzyy19904204639@163.com/
> Co-developed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
> Signed-off-by: Darong Lu <zzyy19904204639@163.com>
> Signed-off-by: Ren Wei <weir@nebusec.ai>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> include/net/ip_vs.h | 4 +-
> net/netfilter/ipvs/ip_vs_ctl.c | 109 ++++++++++++++++++++++++++-------
> 2 files changed, 90 insertions(+), 23 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index ce9fe20d6106..7f10cf5b48c7 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1566,11 +1615,18 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
>
> ret = ip_vs_start_estimator(svc->ipvs, &dest->stats);
> /* On error put back dest into the trash */
> - if (ret < 0)
> - ip_vs_trash_put_dest(svc->ipvs, dest, dest->idle_start,
> - false);
> - else
> + if (ret < 0) {
> + ip_vs_trash_put_back(svc->ipvs, dest);
> + } else {
> + /* Readers may still follow the n_list/d_list of the
> + * unlinked dest, wait before linking it again.
> + */
> + cond_synchronize_rcu(dest->rcu_state);
> + /* need_gp matters only on dest edit, reinit it */
> + dest->need_gp = 0;
> +
> __ip_vs_update_dest(svc, dest, udest, 1);
> + }
BTW, this patch needs a little fix above:
https://sashiko.dev/#/patchset/20261102005654.532438-1-pablo%40netfilter.org
I'll post more info soon.
Regards
--
Julian Anastasov <ja@ssi.bg>
next prev parent reply other threads:[~2026-11-03 14:18 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 14:02 [PATCH net,v2 00/15] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2026-11-03 14:02 ` [PATCH nf-next] netfilter: flowtable: do not scrub as crossing netns Pablo Neira Ayuso
2026-11-03 14:08 ` netdev-bot+sinfo
2026-11-03 14:10 ` Pablo Neira Ayuso
2026-11-03 14:02 ` [PATCH net 01/15] netfilter: nft_reject: prevent unbounded recursion in output hooks Pablo Neira Ayuso
2026-11-03 14:08 ` netdev-bot+sinfo
2026-11-03 14:11 ` Pablo Neira Ayuso
2026-11-03 14:02 ` [PATCH net 02/15] ipvs: wait grace period while reusing dest from trash Pablo Neira Ayuso
2026-11-03 14:18 ` Julian Anastasov [this message]
2026-11-04 14:29 ` netdev-bot+sashiko
2026-11-03 14:02 ` [PATCH net 03/15] ipvs: Defer application parent freeing until after RCU readers Pablo Neira Ayuso
2026-11-03 14:02 ` [PATCH net 04/15] ipvs: fix protocol data lifetime during namespace teardown Pablo Neira Ayuso
2026-11-03 14:02 ` [PATCH net 05/15] ipvs: do not create conns from packets with port 0 Pablo Neira Ayuso
2026-11-04 14:29 ` netdev-bot+sashiko
2026-11-03 14:02 ` [PATCH net 06/15] netfilter: nf_conntrack: limit expectation master chain depth Pablo Neira Ayuso
2026-11-04 14:29 ` netdev-bot+sashiko
2026-11-03 14:03 ` [PATCH net 07/15] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Pablo Neira Ayuso
2026-11-04 14:29 ` netdev-bot+sashiko
2026-11-03 14:03 ` [PATCH net 08/15] netfilter: flowtable: extend ct timeout of offloaded GRE flows Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 09/15] netfilter: nft_set_rbtree: check catchall_sync return before queue_done Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 10/15] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 11/15] netfilter: x_tables: check target name before accessing verdict Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 12/15] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 13/15] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Pablo Neira Ayuso
2026-11-04 14:29 ` netdev-bot+sashiko
2026-11-03 14:03 ` [PATCH net 14/15] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Pablo Neira Ayuso
2026-11-03 14:03 ` [PATCH net 15/15] netfilter: nat: zero newrange before filling it in Pablo Neira Ayuso
2026-11-03 17:06 ` [PATCH net,v2 00/15] Netfilter/IPVS fixes for net Pablo Neira Ayuso
-- strict thread matches above, loose matches on Subject: below --
2026-11-02 0:56 [PATCH net " Pablo Neira Ayuso
2026-11-02 0:56 ` [PATCH net 02/15] ipvs: wait grace period while reusing dest from trash Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15ccbaa8-170c-d920-866f-ece97d6def13@ssi.bg \
--to=ja@ssi.bg \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox