[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVDN_LPsa2XgVWoqMjrOYpg9JNjPJVwEvTuxPgYyWRWmg@mail.gmail.com>
Date: Thu, 24 Mar 2016 17:15:18 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Wei Wang <weiwan@...gle.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Martin KaFai Lau <kafai@...com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Julian Anastasov <ja@....bg>
Subject: Re: [RFT Patch net 1/2] ipv6: invalidate the socket cached route on
pmtu events if possible
On Thu, Mar 24, 2016 at 1:35 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Thu, 2016-03-24 at 12:25 -0700, Cong Wang wrote:
>
>> void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
>> {
>> - ip6_update_pmtu(skb, sock_net(sk), mtu,
>> - sk->sk_bound_dev_if, sk->sk_mark);
>> + const struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
>> + struct net *net = sock_net(sk);
>> + struct dst_entry *ndst, *dst;
>> + struct flowi6 fl6;
>> + bool new = false;
>> +
>> + memset(&fl6, 0, sizeof(fl6));
>> +
>> + bh_lock_sock(sk);
>> +
>
>
> This is not clear why you need to acquire socket lock.
>
> sk_dst_cache is protected by an atomic operation.
>
> udp for example calls ip6_dst_store() without socket being locked.
My understanding is that bh_lock_sock() prevents concurrent
access to sock struct. Since this is in softirq context, multiple
CPU's could call this function concurrently, the whole pmtu
update needs to be done atomically.
UDP, on the other hand, doesn't do this logic, it just looks up
for dst and save it in sk_dst_cache.
Powered by blists - more mailing lists