Message ID | 1585168044-102049-1-git-send-email-xiangxia.m.yue@gmail.com |
---|---|
State | Awaiting Upstream |
Headers | show |
Series | [ovs-dev] net: openvswitch: use hlist_for_each_entry_rcu instead of hlist_for_each_entry | expand |
On 3/25/2020 1:27 PM, xiangxia.m.yue@gmail.com wrote: > From: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > The struct sw_flow is protected by RCU, when traversing them, > use hlist_for_each_entry_rcu. > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> > --- > net/openvswitch/flow_table.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c > index fd8a01c..b7b5744 100644 > --- a/net/openvswitch/flow_table.c > +++ b/net/openvswitch/flow_table.c > @@ -462,12 +462,14 @@ static void flow_table_copy_flows(struct table_instance *old, > struct hlist_head *head = &old->buckets[i]; > > if (ufid) > - hlist_for_each_entry(flow, head, > - ufid_table.node[old_ver]) > + hlist_for_each_entry_rcu(flow, head, > + ufid_table.node[old_ver], > + lockdep_ovsl_is_held()) > ufid_table_instance_insert(new, flow); > else > - hlist_for_each_entry(flow, head, > - flow_table.node[old_ver]) > + hlist_for_each_entry_rcu(flow, head, > + flow_table.node[old_ver], > + lockdep_ovsl_is_held()) > table_instance_insert(new, flow); > } > > Applies cleanly and compile test passes. Passes openvswitch kernel testsuite. Code looks fine to me. Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com>
From: xiangxia.m.yue@gmail.com Date: Thu, 26 Mar 2020 04:27:24 +0800 > From: Tonghao Zhang <xiangxia.m.yue@gmail.com> > > The struct sw_flow is protected by RCU, when traversing them, > use hlist_for_each_entry_rcu. > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Applied.
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index fd8a01c..b7b5744 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c @@ -462,12 +462,14 @@ static void flow_table_copy_flows(struct table_instance *old, struct hlist_head *head = &old->buckets[i]; if (ufid) - hlist_for_each_entry(flow, head, - ufid_table.node[old_ver]) + hlist_for_each_entry_rcu(flow, head, + ufid_table.node[old_ver], + lockdep_ovsl_is_held()) ufid_table_instance_insert(new, flow); else - hlist_for_each_entry(flow, head, - flow_table.node[old_ver]) + hlist_for_each_entry_rcu(flow, head, + flow_table.node[old_ver], + lockdep_ovsl_is_held()) table_instance_insert(new, flow); }