[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b96ffcb-fe29-1c49-a266-3e9d20b60d89@ucloud.cn>
Date: Fri, 22 Feb 2019 23:21:14 +0800
From: wenxu <wenxu@...oud.cn>
To: David Ahern <dsahern@...il.com>, davem@...emloft.net,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2] ip_tunnel: Add dst_cache management
lwtunnel_state of ip tunnel
On 2019/2/22 下午11:03, David Ahern wrote:
> On 2/21/19 11:14 PM, wenxu wrote:
>> build_state in the rcu_read_lock and disable the preempt
>>
>> rcu_read_lock();
>> ops = rcu_dereference(lwtun_encaps[encap_type]);
>> if (likely(ops && ops->build_state && try_module_get(ops->owner))) {
>> found = true;
>> ret = ops->build_state(encap, family, cfg, lws, extack);
>> if (ret)
>> module_put(ops->owner);
>> }
>> rcu_read_unlock();
>>
> Missed that.
>
> Once a reference is taken the rcu_read_lock can be dropped before
> calling build_state allowing the allocations to be GFP_KERNEL.
>
I don't think the rcu_read_lock can be dropped. The whole operation of the reference should be protect
in the rcu_read_lock that ensure the ops will not be destroy (if it will be)
Powered by blists - more mailing lists