Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: openvswitch: use hlist_for_each_entry_rcu instead of hlist_for_each_entry

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>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tonghao Zhang and committed by
David S. Miller
64948427 c427bfec

+6 -4
+6 -4
net/openvswitch/flow_table.c
··· 462 462 struct hlist_head *head = &old->buckets[i]; 463 463 464 464 if (ufid) 465 - hlist_for_each_entry(flow, head, 466 - ufid_table.node[old_ver]) 465 + hlist_for_each_entry_rcu(flow, head, 466 + ufid_table.node[old_ver], 467 + lockdep_ovsl_is_held()) 467 468 ufid_table_instance_insert(new, flow); 468 469 else 469 - hlist_for_each_entry(flow, head, 470 - flow_table.node[old_ver]) 470 + hlist_for_each_entry_rcu(flow, head, 471 + flow_table.node[old_ver], 472 + lockdep_ovsl_is_held()) 471 473 table_instance_insert(new, flow); 472 474 } 473 475