Skip to content

Commit

Permalink
northd: Fix lflow ref node's reference counting.
Browse files Browse the repository at this point in the history
When the lflows in an lflow_ref are unlinked by calling
lflow_ref_unlink_lflows(lflow_ref), the dp_ref counter
for each lflow in the lflow_ref is decremented (by calling
dp_refcnt_release()),  but it is not incremented later
when the same lflow is linked back to the lflow_ref.

This patch fixes it.

Fixes: a623606 ("northd: Refactor lflow management into a separate module.")

Signed-off-by: Numan Siddique <[email protected]>
  • Loading branch information
numansiddique committed Feb 8, 2024
1 parent 3a01e69 commit 850a8b4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions northd/lflow-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,19 +690,24 @@ lflow_table_add_lflow(struct lflow_table *lflow_table,
if (lrn->dpgrp_lflow) {
lrn->dpgrp_bitmap = bitmap_clone(dp_bitmap, dp_bitmap_len);
lrn->dpgrp_bitmap_len = dp_bitmap_len;
} else {
lrn->dp_index = od->index;
}
ovs_list_insert(&lflow->referenced_by, &lrn->ref_list_node);
hmap_insert(&lflow_ref->lflow_ref_nodes, &lrn->ref_node, hash);
}

if (!lrn->linked) {
if (lrn->dpgrp_lflow) {
ovs_assert(lrn->dpgrp_bitmap_len == dp_bitmap_len);
size_t index;
BITMAP_FOR_EACH_1 (index, dp_bitmap_len, dp_bitmap) {
dp_refcnt_use(&lflow->dp_refcnts_map, index);
}
} else {
lrn->dp_index = od->index;
dp_refcnt_use(&lflow->dp_refcnts_map, lrn->dp_index);
}
ovs_list_insert(&lflow->referenced_by, &lrn->ref_list_node);
hmap_insert(&lflow_ref->lflow_ref_nodes, &lrn->ref_node, hash);
}

lrn->linked = true;
}

Expand Down

0 comments on commit 850a8b4

Please sign in to comment.