From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADAE1250C06 for ; Wed, 11 Mar 2026 13:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773235667; cv=none; b=LnEYjcb6UFVbX69Kc0C0XDnf54LZI6vdOKo1VA2iK6z7qjCqX47gcXhd27WqOcWUGV1PSG4/3sq3YFYQ6kw0XIEvWoK/CEaBklmNqESnAK7hnzEMjev5ypBqkFGbj4boQ0lIuJ5dx+g3qXv9lyihHhGGVWAUCtGgtf/nTA7+oYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773235667; c=relaxed/simple; bh=Qi0FNc6l3xlf4M5GgzFlPm9w48wQ+Cr9ucelOJJzMmg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u49v9kMS36d+V9WYzZAWVWQUvpfd46tIzOal5OpzVjq3LF34zrWpoqD/ALz9R1d35XRU5OiFOwjeFkJ6Mv0dPloGX/EO17sEheTrdN7jMV2uTkgMF9Mc4fhHrnXucA+imegVqr8YvAu+v4oqveI8rr16UocOp+zbnynFaF8HQFk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=HnEdIysk; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Eczk5gPc; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="HnEdIysk"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Eczk5gPc" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id C37E8EC05AC; Wed, 11 Mar 2026 09:27:42 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Wed, 11 Mar 2026 09:27:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1773235662; x=1773322062; bh=h6y0IFIVXWgpALqIzRmnvFlM8wDy3FmJ Mbqp1sSaMT8=; b=HnEdIyskvmZ5XGNeRiB4EwUnp5P4RX2xpRgnZtPgUd6h93+a HQQkMPVY/4unzt1Xm3lnNqA7Ye+M+yZBsiyPsAXvfBjyQUkeK8i6EqidM6Qi2Ab0 7PkYUIMzZ3fP261lYbPBURLtYBQXTwZQZdc56GEJJ2Nl3YLtiGt+2AEuHoVX+OBM DO841qHKQ6P6by4VgWwV4qSoz0lc6ByT4Y1/xLvB5znR6enwMvxB2+oOQuW9TRb8 oOobLFh0gQ42ggb+cg6zyUA98mFe/+PuEoZWM5EfYgIfCNMOShhJPAciywHtIbAp sW6eg1WlZmBKSV554BRf68evWAzcLyncGrglJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1773235662; x= 1773322062; bh=h6y0IFIVXWgpALqIzRmnvFlM8wDy3FmJMbqp1sSaMT8=; b=E czk5gPcBVHuZIWk750TImgYh0BtMlb6a7Iktq/VPsiweQqQXcalHGQJ9ft6Py4g4 xauiWPQPyYrZvRZ839XRXUnr6c4334T+kKOZoHmuVLp615nnfo+qsDJYjxPbm1Lk 1CP9NFJjUnLFSrRjFtlDr/OkbXtVWMT+fyQ/RX2I6JQ/bGNCKKMjnPTmkf6bGgXw Tkou51dSCpP6EKzQ+USk5h36Rbg35RhD2+pJslotlG6eznRfAk8bg0A4jUAqwEIs +9FKlES62ws6B7Qo6CjKNwRd0SlXFupBDsg/qgJXG5LcIFyH7+yhRKSvgZty2YDR QhNyJdgn1JuNjjlnLxgaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvkeegtddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpefurggsrhhi nhgrucffuhgsrhhotggruceoshgusehquhgvrghshihsnhgrihhlrdhnvghtqeenucggtf frrghtthgvrhhnpefgvdegieetffefvdfguddtleegiefhgeeuheetveevgeevjeduleef ffeiheelvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsugesqhhuvggrshihshhnrghilhdrnhgvthdpnhgspghrtghpthhtohepuddtpdhm ohguvgepshhmthhpohhuthdprhgtphhtthhopegvhigrlhdrsghirhhgvghrsehgmhgrih hlrdgtohhmpdhrtghpthhtohepihhmvhegsggvlhesghhmrghilhdrtghomhdprhgtphht thhopehsthgvfhhfvghnrdhklhgrshhsvghrthesshgvtghunhgvthdrtghomhdprhgtph htthhopehhvghrsggvrhhtsehgohhnughorhdrrghprghnrgdrohhrghdrrghupdhrtghp thhtohepuggrvhgvmhesuggrvhgvmhhlohhfthdrnhgvthdprhgtphhtthhopegvughumh griigvthesghhoohhglhgvrdgtohhmpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdr ohhrghdprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhmpdhrtghpthhtoh ephhhorhhmsheskhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Mar 2026 09:27:40 -0400 (EDT) Date: Wed, 11 Mar 2026 14:27:39 +0100 From: Sabrina Dubroca To: Eyal Birger Cc: Hyunwoo Kim , steffen.klassert@secunet.com, herbert@gondor.apana.org.au, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net] xfrm: Fix work re-schedule after cancel in xfrm_nat_keepalive_net_fini() Message-ID: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 2026-03-11, 06:00:03 -0700, Eyal Birger wrote: > On Wed, Mar 11, 2026 at 2:26 AM Sabrina Dubroca wrote: > > > > 2026-03-10, 17:14:19 -0700, Eyal Birger wrote: > > > Hi, > > > > > > On Tue, Mar 10, 2026 at 3:57 PM Sabrina Dubroca wrote: > > > > > > > > Please also CC the author, and maybe additional contributors, of the > > > > patch that introduced the problem you're fixing. > > > > > > > > 2026-03-11, 03:16:29 +0900, Hyunwoo Kim wrote: > > > > > After cancel_delayed_work_sync() is called from > > > > > xfrm_nat_keepalive_net_fini(), xfrm_state_fini() flushes remaining > > > > > states via __xfrm_state_delete(), which calls > > > > > xfrm_nat_keepalive_state_updated() to re-schedule nat_keepalive_work. > > > > > > > > Eyal, I'm wondering why __xfrm_state_delete() calls > > > > xfrm_nat_keepalive_state_updated(). At this point the state has been > > > > removed from the walk list so nat_keepalive_work() won't do > > > > anything. Am I missing something? > > > > > > I don't remember for sure, but I think the idea was to have the work > > > run "now" so that when deleting the last nat-keepalive state it > > > won't run in the future, and in general to refresh the interval and > > > not wait for the next iteration. > > > > > > Eyal. > > > > Ok. I thought about this, but I'm not seeing the benefit of doing > > that. Assuming we're deleting just this one state, the next run will > > process all the remaining states in the same way, whether it happens > > right now or at the previously scheduled time: > > > > - if the next run was needed by the peer we're deleting, not much > > changes except that we're recomputing the delay earlier than > > otherwise (right now instead of when deleted_state's interval runs > > out) > > > > - if some other state was the first to need a keepalive, we do a run > > for nothing > > > > So I think we could drop the xfrm_nat_keepalive_state_updated call > > from __xfrm_state_delete. > > Right. I think at the time I didn't think it was "nice" to have the > work running long after all states have been deleted, and also it > decoupled the implementation a little - i.e. if instead of a global > work we had per-state timers (which one of the original versions had). Ok, I see. Thanks. > > @Hyunwoo here again I'm not opposed to s/cancel/disable/, it makes > > sense to use disable_ in a "destruct" operation where we don't plan to > > need the work again. But AFAICT this schedule_delayed_work isn't > > really useful. > > I'm fine with both approaches. Ok, so: Reviewed-by: Sabrina Dubroca Hyunwoo, if you want to send a v2 that does disable_ + remove the xfrm_nat_keepalive_state_updated call, or keep this one as-is (and then we can remove the unnecessary xfrm_nat_keepalive_state_updated call in -next later), that's ok for me either way. Thanks. BTW, patches for "NETWORKING [IPSEC]" should be tagged as [PATCH ipsec] or [PATCH ipsec-next] rather than [PATCH net] or [PATCH net-next]. They go through Steffen Klassert's ipsec/ipsec-next trees, and get pulled into net/net-next a bit later. -- Sabrina