From: Jesse Gross Date: Mon, 6 Dec 2010 19:26:16 +0000 (-0800) Subject: datapath: Don't rcu_dereference() objects in table. X-Git-Tag: v1.1.0~675 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=79863c64f9085114759fb1125e35f377301441fb;p=sliver-openvswitch.git datapath: Don't rcu_dereference() objects in table. Each time that we modify the flow/port table, we reallocate the array of pointers to objects in a particular bucket. We then use RCU to update the link to that bucket. This means that we don't need to use RCU to access the individual object pointers, since they are constant for a given instance of the bucket data structure. This doesn't cause a problem per se (though it does restrict the optimizations that the compiler can perform and adds a memory barrier on Alpha). However, it is confusing and inconsistent since the pointers are not protected by RCU and we don't use rcu_assign_pointer(). Found by sparse. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/table.c b/datapath/table.c index 86236e924..cfe7b2b95 100644 --- a/datapath/table.c +++ b/datapath/table.c @@ -174,7 +174,7 @@ static int search_bucket(const struct tbl_bucket *bucket, void *target, u32 hash int i; for (i = 0; i < bucket->n_objs; i++) { - struct tbl_node *obj = rcu_dereference(bucket->objs[i]); + struct tbl_node *obj = bucket->objs[i]; if (obj->hash == hash && likely(cmp(obj, target))) return i; }