[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100319072053.GA22913@gondor.apana.org.au>
Date: Fri, 19 Mar 2010 15:20:53 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Timo Teras <timo.teras@....fi>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] xfrm: cache bundle lookup results in flow cache
On Mon, Mar 15, 2010 at 02:20:10PM +0200, Timo Teras wrote:
>
> - policy = flow_cache_lookup(net, fl, dst_orig->ops->family,
> - dir, xfrm_policy_lookup);
> - err = PTR_ERR(policy);
> - if (IS_ERR(policy)) {
> - XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
> - goto dropdst;
> + fce = flow_cache_lookup(&net->xfrm.flow_cache,
> + fl, family, dir);
> + if (fce == NULL)
> + goto no_cache;
> +
> + xf = container_of(fce, struct xfrm_flow_cache_entry, fce);
> + xfrm_flow_cache_entry_validate(&net->xfrm.flow_cache, fce);
This doesn't work.
The flow cache operates without locking as it is a per-cpu cache.
To make this work you must ensure that you stay on the same CPU
or use some other form of synchronoisation if you write to the
object returned.
AFAICS there is no synchronisation here and you're writing to fce.
So you'll need to disable preemption around the bit that touches
fce.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists