netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Timo Teräs" <timo.teras@iki.fi>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/4] xfrm: increment genid before bumping state genids
Date: Wed, 31 Mar 2010 14:01:03 +0300	[thread overview]
Message-ID: <4BB32B6F.7060403@iki.fi> (raw)
In-Reply-To: <4BB32A11.1030708@iki.fi>

Timo Teräs wrote:
> Herbert Xu wrote:
>> On Wed, Mar 31, 2010 at 01:17:03PM +0300, Timo Teras wrote:
>>> __xfrm_state_bump_genids() is used to update the genid of all
>>> matching xfrm_state's, so any bundle using the state would get
>>> refreshed with the newly inserted state.
>>>
>>> However, since __xfrm_state_bump_genids() is called before the
>>> __xfrm_state_insert() which actually bumps the genid counter,
>>> it is possible that the genid was not updated at all (if there
>>> was no state inserts previously).
>>>
>>> This is fixed by moving the genid incrementation to
>>> __xfrm_state_bump_genids() so the older states are guaranteed
>>> to get different genid.
>>>
>>> Signed-off-by: Timo Teras <timo.teras@iki.fi>
>>
>> It would appear that not all xfrm_state_insert calls are preceded
>> by xfrm_state_bump_genids so this patch isn't correct.
> 
> Yes, I noticed that there's one. But __xfrm_state_insert() is
> called to replace an acquire in that case. Acquires are never
> used in bundle, so this is good.
> 
> But maybe it'd be more explicit if the genid increment is done
> before each __xfrm_state_insert()?

Actually. Search for xfrm_state_genid in xfrm_state.c. It's only
used in two places: __xfrm_state_bumb_genid() and _insert().

The only case when it needs to get incremented is in the bump
function. If we are adding a state for the first time, there's
no need to bump the genid as it's per-matching state. The actual
work to invalidate states is done in the bump function, so it's
the only place that needs to increment it.

If any other xfrm_state_insert place needs to invalidate old
states it needs an additional bumping call. So the bumping function
is the right place to increment the genid.

  reply	other threads:[~2010-03-31 11:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 10:17 [PATCH 0/4] xfrm fixes and flow structurization Timo Teras
2010-03-31 10:17 ` Timo Teras
2010-03-31 10:17 ` [PATCH 1/4] xfrm: increment genid before bumping state genids Timo Teras
2010-03-31 10:50   ` Herbert Xu
2010-03-31 10:55     ` Timo Teräs
2010-03-31 11:01       ` Timo Teräs [this message]
2010-03-31 11:19         ` Herbert Xu
2010-03-31 11:24           ` Timo Teräs
2010-03-31 10:17 ` [PATCH 2/4] xfrm_user: verify policy direction at XFRM_MSG_POLEXPIRE handler Timo Teras
2010-03-31 10:54   ` Herbert Xu
2010-03-31 10:17 ` [PATCH 3/4] xfrm: remove policy lock when accessing policy->walk.dead Timo Teras
2010-03-31 11:03   ` Herbert Xu
2010-03-31 13:06     ` jamal
2010-03-31 13:11       ` Herbert Xu
2010-03-31 13:26         ` Herbert Xu
2010-03-31 13:32           ` jamal
2010-03-31 13:39             ` jamal
2010-03-31 13:41               ` jamal
2010-03-31 13:56                 ` Herbert Xu
2010-03-31 14:15                   ` jamal
2010-03-31 20:54                   ` David Miller
2010-03-31 13:55               ` Herbert Xu
2010-03-31 14:12                 ` jamal
2010-03-31 14:15                   ` Herbert Xu
2010-03-31 14:24                     ` jamal
2010-03-31 14:29                       ` Herbert Xu
2010-03-31 14:38                         ` jamal
2010-03-31 20:57                     ` David Miller
2010-04-01  0:22                       ` Herbert Xu
2010-04-01  2:19                         ` jamal
2010-04-01 10:53                           ` jamal
2010-03-31 13:28         ` jamal
2010-03-31 13:53           ` Herbert Xu
2010-03-31 16:41             ` Patrick McHardy
2010-03-31 17:47               ` jamal
2010-04-01 11:24                 ` Patrick McHardy
2010-03-31 20:52             ` David Miller
2010-03-31 10:17 ` [PATCH 4/4] flow: structurize flow cache Timo Teras
2010-03-31 11:21   ` Herbert Xu
2010-04-02  2:42 ` [PATCH 0/4] xfrm fixes and flow structurization David Miller

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=4BB32B6F.7060403@iki.fi \
    --to=timo.teras@iki.fi \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).