@@ -173,6 +173,7 @@ static struct hlist_head *vport_hash_bucket(const struct datapath *dp,
173
173
return & dp -> ports [port_no & (DP_VPORT_HASH_BUCKETS - 1 )];
174
174
}
175
175
176
+ /* Called with ovs_mutex or RCU read lock. */
176
177
struct vport * ovs_lookup_vport (const struct datapath * dp , u16 port_no )
177
178
{
178
179
struct vport * vport ;
@@ -652,7 +653,7 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts)
652
653
+ nla_total_size (acts -> actions_len ); /* OVS_FLOW_ATTR_ACTIONS */
653
654
}
654
655
655
- /* Called with ovs_mutex. */
656
+ /* Called with ovs_mutex or RCU read lock . */
656
657
static int ovs_flow_cmd_fill_info (struct sw_flow * flow , struct datapath * dp ,
657
658
struct sk_buff * skb , u32 portid ,
658
659
u32 seq , u32 flags , u8 cmd )
@@ -743,6 +744,7 @@ static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
743
744
return err ;
744
745
}
745
746
747
+ /* Must be called with ovs_mutex. */
746
748
static struct sk_buff * ovs_flow_cmd_alloc_info (struct sw_flow * flow ,
747
749
struct genl_info * info )
748
750
{
@@ -753,6 +755,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(struct sw_flow *flow,
753
755
return genlmsg_new_unicast (len , info , GFP_KERNEL );
754
756
}
755
757
758
+ /* Must be called with ovs_mutex. */
756
759
static struct sk_buff * ovs_flow_cmd_build_info (struct sw_flow * flow ,
757
760
struct datapath * dp ,
758
761
struct genl_info * info ,
@@ -1094,6 +1097,7 @@ static size_t ovs_dp_cmd_msg_size(void)
1094
1097
return msgsize ;
1095
1098
}
1096
1099
1100
+ /* Called with ovs_mutex or RCU read lock. */
1097
1101
static int ovs_dp_cmd_fill_info (struct datapath * dp , struct sk_buff * skb ,
1098
1102
u32 portid , u32 seq , u32 flags , u8 cmd )
1099
1103
{
@@ -1109,9 +1113,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
1109
1113
1110
1114
ovs_header -> dp_ifindex = get_dpifindex (dp );
1111
1115
1112
- rcu_read_lock ();
1113
1116
err = nla_put_string (skb , OVS_DP_ATTR_NAME , ovs_dp_name (dp ));
1114
- rcu_read_unlock ();
1115
1117
if (err )
1116
1118
goto nla_put_failure ;
1117
1119
@@ -1136,6 +1138,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
1136
1138
return - EMSGSIZE ;
1137
1139
}
1138
1140
1141
+ /* Must be called with ovs_mutex. */
1139
1142
static struct sk_buff * ovs_dp_cmd_build_info (struct datapath * dp ,
1140
1143
struct genl_info * info , u8 cmd )
1141
1144
{
@@ -1154,7 +1157,7 @@ static struct sk_buff *ovs_dp_cmd_build_info(struct datapath *dp,
1154
1157
return skb ;
1155
1158
}
1156
1159
1157
- /* Called with ovs_mutex. */
1160
+ /* Called with rcu_read_lock or ovs_mutex. */
1158
1161
static struct datapath * lookup_datapath (struct net * net ,
1159
1162
struct ovs_header * ovs_header ,
1160
1163
struct nlattr * a [OVS_DP_ATTR_MAX + 1 ])
@@ -1166,10 +1169,8 @@ static struct datapath *lookup_datapath(struct net *net,
1166
1169
else {
1167
1170
struct vport * vport ;
1168
1171
1169
- rcu_read_lock ();
1170
1172
vport = ovs_vport_locate (net , nla_data (a [OVS_DP_ATTR_NAME ]));
1171
1173
dp = vport && vport -> port_no == OVSP_LOCAL ? vport -> dp : NULL ;
1172
- rcu_read_unlock ();
1173
1174
}
1174
1175
return dp ? dp : ERR_PTR (- ENODEV );
1175
1176
}
0 commit comments