netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: wenxu <wenxu@ucloud.cn>, davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel
Date: Fri, 22 Feb 2019 17:16:37 -0500	[thread overview]
Message-ID: <76715d1b-00a9-8da2-2af5-7a2198de9b8a@gmail.com> (raw)
In-Reply-To: <8b96ffcb-fe29-1c49-a266-3e9d20b60d89@ucloud.cn>

On 2/22/19 10:21 AM, wenxu wrote:
> 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)
> 

If 'try_module_get(ops->owner)' succeeds then a reference is held so the
ops will not go away.

      reply	other threads:[~2019-02-22 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  3:00 [PATCH net-next v2] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel wenxu
2019-02-22  3:39 ` David Ahern
2019-02-22  4:14   ` wenxu
2019-02-22 15:03     ` David Ahern
2019-02-22 15:21       ` wenxu
2019-02-22 22:16         ` David Ahern [this message]

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=76715d1b-00a9-8da2-2af5-7a2198de9b8a@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=wenxu@ucloud.cn \
    /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).