2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

Double postponing to free subtables.

Subtable destruction should be double postponed because readers could still obtain old values while iterating over pvector implementation before its new version published.

Signed-off-by: Zhantao Fu <fuzhantao@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Zhantao Fu
2019-04-23 19:04:25 +08:00
committed by Ben Pfaff
parent c94d47d09a
commit 0fcf0776c7
2 changed files with 27 additions and 14 deletions

View File

@@ -7585,6 +7585,13 @@ struct dpcls_subtable {
/* 'mask' must be the last field, additional space is allocated here. */
};
static void
dpcls_subtable_destroy_cb(struct dpcls_subtable *subtable)
{
cmap_destroy(&subtable->rules);
ovsrcu_postpone(free, subtable);
}
/* Initializes 'cls' as a classifier that initially contains no classification
* rules. */
static void
@@ -7601,8 +7608,7 @@ dpcls_destroy_subtable(struct dpcls *cls, struct dpcls_subtable *subtable)
pvector_remove(&cls->subtables, subtable);
cmap_remove(&cls->subtables_map, &subtable->cmap_node,
subtable->mask.hash);
cmap_destroy(&subtable->rules);
ovsrcu_postpone(free, subtable);
ovsrcu_postpone(dpcls_subtable_destroy_cb, subtable);
}
/* Destroys 'cls'. Rules within 'cls', if any, are not freed; this is the