[ovs-dev] [PATCH 1/2] datapath: Fix race and clarify locking.

Jesse Gross jesse at nicira.com
Tue Feb 4 22:28:24 UTC 2014


On Tue, Feb 4, 2014 at 1:25 PM, Pravin Shelar <pshelar at nicira.com> wrote:
> On Tue, Feb 4, 2014 at 11:10 AM, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
>> diff --git a/datapath/datapath.c b/datapath/datapath.c
>> index 5f1b34c..7992330 100644
>> --- a/datapath/datapath.c
>> +++ b/datapath/datapath.c
>> @@ -116,20 +116,19 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *,
>>  static int queue_userspace_packet(struct datapath *dp, struct sk_buff *,
>>                                   const struct dp_upcall_info *);
>>
>> -/* Must be called with rcu_read_lock or ovs_mutex. */
>> +/* Must be called with rcu_read_lock or ovs_mutex, so no additional protection
>> + * is needed here. */
>>  static struct datapath *get_dp(struct net *net, int dp_ifindex)
>>  {
>>         struct datapath *dp = NULL;
>>         struct net_device *dev;
>>
>> -       rcu_read_lock();
>>         dev = dev_get_by_index_rcu(net, dp_ifindex);
>>         if (dev) {
>>                 struct vport *vport = ovs_internal_dev_get_vport(dev);
>>                 if (vport)
>>                         dp = vport->dp;
>>         }
>> -       rcu_read_unlock();
>>
>
> dev_get_by_index_rcu() needs RCU lock, so we can not remove this rcu-read-lock.

This should also be two patches: fixing the bug and changing other locking.



More information about the dev mailing list