public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hyunwoo Kim <imv4bel@gmail.com>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: Eyal Birger <eyal.birger@gmail.com>,
	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,
	imv4bel@gmail.com
Subject: Re: [PATCH net] xfrm: Fix work re-schedule after cancel in xfrm_nat_keepalive_net_fini()
Date: Wed, 11 Mar 2026 19:31:51 +0900	[thread overview]
Message-ID: <abFEl98lHzRIORgb@v4bel> (raw)
In-Reply-To: <abE1Q7BMvZ1l14jF@krikkit>

On Wed, Mar 11, 2026 at 10:26:27AM +0100, 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 <sd@queasysnail.net> 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.
> 
> 
> @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.

Thank you for the review. 
Should I submit a v2 patch that removes the 
xfrm_nat_keepalive_state_updated() call from __xfrm_state_delete()?


Best regards,
Hyunwoo Kim

  reply	other threads:[~2026-03-11 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 18:16 [PATCH net] xfrm: Fix work re-schedule after cancel in xfrm_nat_keepalive_net_fini() Hyunwoo Kim
2026-03-10 22:57 ` Sabrina Dubroca
2026-03-11  0:14   ` Eyal Birger
2026-03-11  9:26     ` Sabrina Dubroca
2026-03-11 10:31       ` Hyunwoo Kim [this message]
2026-03-11 13:00       ` Eyal Birger
2026-03-11 13:27         ` Sabrina Dubroca
2026-03-11 13:40           ` Hyunwoo Kim
2026-03-16  9:57 ` Steffen Klassert

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=abFEl98lHzRIORgb@v4bel \
    --to=imv4bel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eyal.birger@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=steffen.klassert@secunet.com \
    /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