From: Eli Britstein <[email protected]>
Upon modifying a group, the following steps occur:
1. ofproto_group_mod_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 <[email protected]>
Acked-by: Gaetan Rivet <[email protected]>
Acked-by: Roi Dayan <[email protected]>
---
ofproto/ofproto.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index ef615e59c354..323e38a53d6c 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -7939,6 +7939,16 @@ ofproto_group_mod_start(struct ofproto *ofproto, struct
ofproto_group_mod *ogm)
error = OFPERR_OFPGMFC_BAD_COMMAND;
break;
}
+
+ if (!error && ogm->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(ogm->new_group);
+ }
+
return error;
}
@@ -7985,15 +7995,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
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev