LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH nf v3 0/2] ipvs: fix destination overload state updates

To: David Ahern <dsahern@xxxxxxxxxx>, Ido Schimmel <idosch@xxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, Phil Sutter <phil@xxxxxx>
Subject: [PATCH nf v3 0/2] ipvs: fix destination overload state updates
Cc: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, Yuxiang Yang <yangyx22@xxxxxxxxxxxxxxxxxxxxx>, Ao Wang <wangao@xxxxxxxxxx>, Xuewei Feng <fengxw06@xxxxxxx>, Qi Li <qli01@xxxxxxxxxxxxxxx>, Ke Xu <xuke@xxxxxxxxxxxxxxx>
From: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Jul 2026 17:48:00 +0800
IPVS updates a destination's overload status from connection accounting
and destination configuration paths, while schedulers read it from packet
processing paths.

Patch 1, authored by Julian, updates the overload state whenever a
destination's connection thresholds change. It also limits the upper
threshold to the range that can be compared safely with the connection
counter.

Patch 2 moves overload state out of dest->flags, which it previously
shared with the independent availability state. It uses a separate bitset
and bitops so updates to the two states cannot clobber each other. KCSAN
reports the original race between __ip_vs_update_dest() and
ip_vs_sh_schedule(), as well as between ip_vs_bind_dest() and the SH
scheduler.

The series keeps reader-side synchronization lightweight. test_bit() does
not provide a fresh cross-field snapshot, so schedulers may still observe
stale destination state as they could before this change.

Changes in v3:
- Add Julian's fix to properly refresh OVERLOAD on destination edit and 
reject upper thresholds above INT_MAX before comparing them with the signed
connection counter as patch 1/2.
- Keep AVAILABLE in dest->flags and move OVERLOAD to a separate bitset.
- Link to v2: 
https://lore.kernel.org/netfilter-devel/20260708060454.20534-1-zhaoyz24@xxxxxxxxxxxxxxxxxxxxx/

Julian Anastasov (1):
  ipvs: properly update the overload flag on dest edit

Yizhou Zhao (1):
  ipvs: use bitops for destination overload state

 include/net/ip_vs.h              | 10 ++++++++
 include/uapi/linux/ip_vs.h       |  6 -----
 net/netfilter/ipvs/ip_vs_conn.c  | 44 ++++++++++++++++++++++----------
 net/netfilter/ipvs/ip_vs_ctl.c   | 26 +++++++++++++------
 net/netfilter/ipvs/ip_vs_dh.c    |  4 +--
 net/netfilter/ipvs/ip_vs_fo.c    |  2 +-
 net/netfilter/ipvs/ip_vs_lblc.c  |  4 +--
 net/netfilter/ipvs/ip_vs_lblcr.c |  8 +++---
 net/netfilter/ipvs/ip_vs_lc.c    |  2 +-
 net/netfilter/ipvs/ip_vs_mh.c    |  2 +-
 net/netfilter/ipvs/ip_vs_nq.c    |  2 +-
 net/netfilter/ipvs/ip_vs_ovf.c   |  2 +-
 net/netfilter/ipvs/ip_vs_rr.c    |  2 +-
 net/netfilter/ipvs/ip_vs_sed.c   |  4 +--
 net/netfilter/ipvs/ip_vs_sh.c    |  2 +-
 net/netfilter/ipvs/ip_vs_twos.c  |  4 +--
 net/netfilter/ipvs/ip_vs_wlc.c   |  4 +--
 net/netfilter/ipvs/ip_vs_wrr.c   |  2 +-
 18 files changed, 81 insertions(+), 49 deletions(-)


base-commit: 2c7c88a412aa6d09cd04b414211b4ef8553b5309
-- 
2.34.1



<Prev in Thread] Current Thread [Next in Thread>