From: Eli Britstein <el...@nvidia.com>

Upon modifying a group, the following steps occur:
1. ofproto_group_mod_start()->modify_group_start():
   Find an old group object, create a new one.
2. ofproto_bump_tables_version()
3. ofproto_group_mod_finish():
   Modify the new group object with buckets etc.

At step #3, the new group object is already in use by revalidators,
that may read incorrect data while being modified.

Instead, move the group modification of the new object to step #1.

Fixes: 0a8f6beb54ab ("ofproto-dpif: Fix dp_hash mapping after select group 
modification.")
Signed-off-by: Eli Britstein <el...@nvidia.com>
Acked-by: Gaetan Rivet <gaet...@nvidia.com>
Acked-by: Roi Dayan <r...@nvidia.com>
---

Notes:
    v2
    - Move change to modify_group_start().
    - Remove redundant assertion.

 ofproto/ofproto.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index ef615e59c354..a0248c5ba46b 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -7820,6 +7820,13 @@ modify_group_start(struct ofproto *ofproto, struct 
ofproto_group_mod *ogm)
         ofproto->n_groups[old_group->type]--;
         ofproto->n_groups[new_group->type]++;
     }
+
+    if (ofproto->ofproto_class->group_modify) {
+        /* Modify a group. */
+        /* XXX: OK to lose old group's stats? */
+        ofproto->ofproto_class->group_modify(new_group);
+    }
+
     return 0;
 
 out:
@@ -7985,15 +7992,6 @@ ofproto_group_mod_finish(struct ofproto *ofproto,
     struct ofgroup *new_group = ogm->new_group;
     struct ofgroup *old_group;
 
-    if (new_group && group_collection_n(&ogm->old_groups) &&
-        ofproto->ofproto_class->group_modify) {
-        /* Modify a group. */
-        ovs_assert(group_collection_n(&ogm->old_groups) == 1);
-
-        /* XXX: OK to lose old group's stats? */
-        ofproto->ofproto_class->group_modify(new_group);
-    }
-
     /* Delete old groups. */
     GROUP_COLLECTION_FOR_EACH(old_group, &ogm->old_groups) {
         delete_group_finish(ofproto, old_group);
-- 
2.47.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to