Skip to content

Commit 270de5d

Browse files
elibritsteinigsilya
authored andcommitted
ofproto: Move group-modify to mod_start instead of mod_finish.
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: 0a8f6be ("ofproto-dpif: Fix dp_hash mapping after select group modification.") Acked-by: Gaetan Rivet <gaetanr@nvidia.com> Acked-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Eli Britstein <elibr@nvidia.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
1 parent f8d457e commit 270de5d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

ofproto/ofproto.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7820,6 +7820,12 @@ modify_group_start(struct ofproto *ofproto, struct ofproto_group_mod *ogm)
78207820
ofproto->n_groups[old_group->type]--;
78217821
ofproto->n_groups[new_group->type]++;
78227822
}
7823+
7824+
if (ofproto->ofproto_class->group_modify) {
7825+
/* XXX: OK to lose old group's stats? */
7826+
ofproto->ofproto_class->group_modify(new_group);
7827+
}
7828+
78237829
return 0;
78247830

78257831
out:
@@ -7985,15 +7991,6 @@ ofproto_group_mod_finish(struct ofproto *ofproto,
79857991
struct ofgroup *new_group = ogm->new_group;
79867992
struct ofgroup *old_group;
79877993

7988-
if (new_group && group_collection_n(&ogm->old_groups) &&
7989-
ofproto->ofproto_class->group_modify) {
7990-
/* Modify a group. */
7991-
ovs_assert(group_collection_n(&ogm->old_groups) == 1);
7992-
7993-
/* XXX: OK to lose old group's stats? */
7994-
ofproto->ofproto_class->group_modify(new_group);
7995-
}
7996-
79977994
/* Delete old groups. */
79987995
GROUP_COLLECTION_FOR_EACH(old_group, &ogm->old_groups) {
79997996
delete_group_finish(ofproto, old_group);

0 commit comments

Comments
 (0)