๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16118

Re: [PATCH net 08/15] ipvs: update flags and seqs in backup server under lock

#16118
From: netdev-bot+sashiko
Date: Sat, 14 Nov 2026 02:15
69 lines
10070 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message overstates the old bug.

--

ipvs: update flags and seqs in backup server under lock

This patch extends the cp->lock critical section in ip_vs_proc_conn().
On the backup server, cp->flags, in_seq/out_seq, state, old_state and
timeout are now updated together. New connections also take cp->lock,
and ip_vs_try_bind_dest() is called after the lock is dropped.

Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260927220816.268206-1-pablo%40netfilter.org

> Sashiko reports that we modify the conn flags and seq values in
> the backup server without holding cp->lock. The same is true for
> other fields such as state, old_state and timeout which are
> modified by protocols under lock.

[Severity: Low]
Is the first sentence accurate for cp->flags?

Before this patch, the existing-connection path in ip_vs_proc_conn()
already updated cp->flags under cp->lock:

net/netfilter/ipvs/ip_vs_sync.c:ip_vs_proc_conn() {
    ...
		spin_lock_bh(&cp->lock);
		...
		flags &= IP_VS_CONN_F_BACKUP_UPD_MASK;
		flags |= cp->flags & ~IP_VS_CONN_F_BACKUP_UPD_MASK;
		cp->flags = flags;
		spin_unlock_bh(&cp->lock);
		if (!dest)
			ip_vs_try_bind_dest(cp);
    ...
}

ip_vs_try_bind_dest() also takes cp->lock before ip_vs_bind_dest()
changes cp->flags.

The fields written without the lock were the seqs, state, old_state
and timeout, after spin_unlock_bh():

	if (opt) {
		cp->in_seq = opt->in_seq;
		cp->out_seq = opt->out_seq;
	}
	atomic_set(&cp->in_pkts, sysctl_sync_threshold(ipvs));
	cp->state = state;
	cp->old_state = cp->state;

So the IP_VS_CONN_F_SEQ_MASK bits were set under the lock, but the
in_seq/out_seq values they describe were written outside it. The
subject line and "update the fields atomically" describe this
correctly.

Could the first sentence say that flags and seqs were not updated
together under the lock, instead of saying the flags were modified
without it? The code change itself looks correct.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113011447.2357709-2-pablo%40netfilter.org
Technical Details
Message-ID: <179462254476.2199510.10872735133163296509@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363036-linux-kernel-netdev=dewy.ru
References: <20261113011447.2357709-9-pablo@netfilter.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363036-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 08/15] ipvs: update flags and seqs in backup server under lock
Date: Sat, 14 Nov 2026 02:15:44 +0000
Organization: Usenet Network
Message-ID: <179462254476.2199510.10872735133163296509@kernel.org>
References: <20261113011447.2357709-9-pablo@netfilter.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1490225"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:h0xoMxvP5RYWusevO7N9ZWC+2UY= sha256:XRvjbt9rUIFFEiYhxoZBUnmJOn8O96HBLi/1WQq3l5g=
	sha1:qLIunTCWjwoPaR8d+QWIZW6+INM= sha256:9laACF6rdI5d5C3A9sLz2SqBqZtLzkdaBOcxI869WlE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 884BB11473C; Sat, 14 Nov 2026 05:16:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id tuOQtvx2UeMl;
	Sat, 14 Nov 2026 05:16:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363036-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id BA6B2C99D6; Sat, 14 Nov 2026 05:16:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 0A2C231F3B; Sat, 14 Nov 2026 02:16:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794622551;
	b=BovH5soDqclnVRI431WYCu+c2zxtR+JkjxA+JzjsN4BrN5rrFoU2lmD9cwgZvhCNJukO
	 8w6HcaZwpF+MF+Tn6fK4I3+bk6iSON1F/5kYrGDAkZCFYKFhO4Sr/EqOXelHZesSywQoF
	 9jZPu7n8nnooyXsYFozbxsGEUF7JhghirnOfuwTVHxzrCqeoXd/1JuAACl7qukbeha4U1
	 HbOR13bRV8adpNJSSLhRkiuLIxs9uGoJ9VQ4Y34l1Nhmv3RKdB9XMVxpXLX1/THUixJRa
	 TQ3QeuY3/kWvpqVSH/I9XL8MYZAZ0iksQRuIDg+HndyW2nCFytIl1ZQEEN5kH4IAjkw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794622551;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=z4i/fmyOqndkSOxwHcN+Hq4btJ3lhkQBCoXbXJdFXD8=;
	b=I/RBJZz6U3vQU159jitjOJ94f0q6OgFyKcDIiP1soICPA8ubifNepz+8fDCPhSCMwfTc
	 NOShgWLT53eBKMK6+CH4wgrsUmWApBBIG/SEE0bgg3NIznmsbbiIdtFaUFIug01M1A/WV
	 txwRqfrA+SWymjWOSgCp1/Yt6QtCusT9ovPAQfpRZN+U0JZaID2kRgaJm+/A0izr8Hdv4
	 DIlNWK/8Oogl11FSBny7tWstY2d0vWiYWVoIDyBeJ3/EjBsSWx3/i59hTpnEPRYaYImz4
	 36nZ0KiTERWvRKsMW/Cjr8MgywBFnoC0Bh/75iAMn83G0hFl/7kg9Bwq39/cUI/ikcg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GFlktzmA;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id BAFD3606A88E;
	Sat, 14 Nov 2026 02:15:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GFlktzmA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794622545;
	b=JBu0UboWi6Nu6XTZf4f244QToBnGyHrNNA+a2CZiqWmFAMPS/O2Ss24ODEuQ6ipKdrNB
	 fSPbW3IrlG4fVN9hkF3lPYPK/Lug3+iY4un90uP6zsIyIgjJKR94p3Nk9XgI8jojTUuRq
	 6GTmzrKsyM3k5HYbekOzU5MDKUZUhnNmzJBQ5rUjRjRN8NZq6ya+0iLoulFfcZNVDJ0HU
	 JaV8Bp5ECtTclY5fZRUvsvw9/QqvZWeN99V3TclD7qDaTiioVBoycD0FjO5RVf1bg9WQ3
	 jFsKTpyr039eZktI8JNITGSaHTcQEvg35hT5yps5Yfgno7QOgF+IrhPyg8sZPtduv8w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794622545;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=z4i/fmyOqndkSOxwHcN+Hq4btJ3lhkQBCoXbXJdFXD8=;
	b=GqANWuNNvcGsPLU1/5HkuJqlBBbu+z5n0heJWGAcOzunn/tD5bjNQrKt0Z8AiZpo72Gx
	 4uZE22cqBalsvZGVT9mgMgUK5p54XKgerEF4vJn631Jsixz3yT/RasmepPsgKa2V6edfD
	 2bDGy/5YauuP6pV+19RkS/DEYyxkr/8sJsVR1KL9yCpgCNsx9WbWDtVksM32lSK+BuAdf
	 vENd/ui+5/kPMmdXQsrg0nIkV41nujGTVyBv2E/qVshJJH7/x6HNnmpywbXRSDmL1U7DK
	 iBoOuqaF2vJciY5wY/ff6O9hSr7TWo1lxMuf0nQlmTYTuQrxJOO+53DUQWRigQoQjXA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GFlktzmA;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D96DC606A8A8;
	Sat, 14 Nov 2026 02:15:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E2971F000C4;
	Sat, 14 Nov 2026 02:15:45 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794622545;
	bh=z4i/fmyOqndkSOxwHcN+Hq4btJ3lhkQBCoXbXJdFXD8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=GFlktzmARnF8IIMt7e/TjUHjxOiRRPP2gcaNW9lPaSguum10pD7Tb4ZmhQeftrSdY
	 HSG2zzztSDPxJHS4hn42eqmIZnUeu7s1F6K1wsyhjuJfDTiTfDGrfINIST1Tq4p6tM
	 cz/jiy2agNCHpwcMaW1GqGh8bsB3rT9BZ7uAvS5TcoWhsovCAmYwaZv/CyKUPe1BkQ
	 Dj24UsvKq1oAYBiPrJS2NTIZORx05w2zW8cwWMc++4SBb+robReZEeIFprgAdT/GNd
	 /srKGaxPcYWM1E0I9KBXj8FQddptv6C36ofRkl0PDcmWv3Sl8nDyXqQu37RgkYTXjM
	 YWgRE5kDH5qNA==
X-Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
 netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
 edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg
X-In-Reply-To: <20261113011447.2357709-9-pablo@netfilter.org>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list