@@ -173,6 +173,7 @@ static struct hlist_head *vport_hash_bucket(const struct datapath *dp,
173173 return & dp -> ports [port_no & (DP_VPORT_HASH_BUCKETS - 1 )];
174174}
175175
176+ /* Called with ovs_mutex or RCU read lock. */
176177struct vport * ovs_lookup_vport (const struct datapath * dp , u16 port_no )
177178{
178179 struct vport * vport ;
@@ -652,7 +653,7 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts)
652653 + nla_total_size (acts -> actions_len ); /* OVS_FLOW_ATTR_ACTIONS */
653654}
654655
655- /* Called with ovs_mutex. */
656+ /* Called with ovs_mutex or RCU read lock . */
656657static int ovs_flow_cmd_fill_info (struct sw_flow * flow , struct datapath * dp ,
657658 struct sk_buff * skb , u32 portid ,
658659 u32 seq , u32 flags , u8 cmd )
@@ -743,6 +744,7 @@ static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
743744 return err ;
744745}
745746
747+ /* Must be called with ovs_mutex. */
746748static struct sk_buff * ovs_flow_cmd_alloc_info (struct sw_flow * flow ,
747749 struct genl_info * info )
748750{
@@ -753,6 +755,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(struct sw_flow *flow,
753755 return genlmsg_new_unicast (len , info , GFP_KERNEL );
754756}
755757
758+ /* Must be called with ovs_mutex. */
756759static struct sk_buff * ovs_flow_cmd_build_info (struct sw_flow * flow ,
757760 struct datapath * dp ,
758761 struct genl_info * info ,
@@ -1094,6 +1097,7 @@ static size_t ovs_dp_cmd_msg_size(void)
10941097 return msgsize ;
10951098}
10961099
1100+ /* Called with ovs_mutex or RCU read lock. */
10971101static int ovs_dp_cmd_fill_info (struct datapath * dp , struct sk_buff * skb ,
10981102 u32 portid , u32 seq , u32 flags , u8 cmd )
10991103{
@@ -1109,9 +1113,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
11091113
11101114 ovs_header -> dp_ifindex = get_dpifindex (dp );
11111115
1112- rcu_read_lock ();
11131116 err = nla_put_string (skb , OVS_DP_ATTR_NAME , ovs_dp_name (dp ));
1114- rcu_read_unlock ();
11151117 if (err )
11161118 goto nla_put_failure ;
11171119
@@ -1136,6 +1138,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
11361138 return - EMSGSIZE ;
11371139}
11381140
1141+ /* Must be called with ovs_mutex. */
11391142static struct sk_buff * ovs_dp_cmd_build_info (struct datapath * dp ,
11401143 struct genl_info * info , u8 cmd )
11411144{
@@ -1154,7 +1157,7 @@ static struct sk_buff *ovs_dp_cmd_build_info(struct datapath *dp,
11541157 return skb ;
11551158}
11561159
1157- /* Called with ovs_mutex. */
1160+ /* Called with rcu_read_lock or ovs_mutex. */
11581161static struct datapath * lookup_datapath (struct net * net ,
11591162 struct ovs_header * ovs_header ,
11601163 struct nlattr * a [OVS_DP_ATTR_MAX + 1 ])
@@ -1166,10 +1169,8 @@ static struct datapath *lookup_datapath(struct net *net,
11661169 else {
11671170 struct vport * vport ;
11681171
1169- rcu_read_lock ();
11701172 vport = ovs_vport_locate (net , nla_data (a [OVS_DP_ATTR_NAME ]));
11711173 dp = vport && vport -> port_no == OVSP_LOCAL ? vport -> dp : NULL ;
1172- rcu_read_unlock ();
11731174 }
11741175 return dp ? dp : ERR_PTR (- ENODEV );
11751176}
0 commit comments