From 8a68b43c24a85b667e90d6463286d13bd2724b3f Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Tue, 23 Dec 2014 14:15:44 -0800 Subject: [PATCH] Warn the free of 'recirc_id' by wrong 'ofproto'. Issues a ERR log when the 'recirc_id' is not freed by the owning 'ofproto'. Signed-off-by: Alex Wang Acked-by: Andy Zhou --- ofproto/ofproto-dpif.c | 7 +++++++ tests/ofproto-dpif.at | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 39288c1cf..dc555ddde 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4841,6 +4841,13 @@ ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, uint32_t recirc_id) hmap_remove(&backer->recirc_map, &node->hmap_node); ovs_mutex_unlock(&backer->recirc_mutex); recirc_id_free(backer->rid_pool, node->recirc_id); + + if (node->ofproto != ofproto) { + VLOG_ERR("recirc_id %"PRIu32", freed by incorrect ofproto (%s)," + " expect ofproto (%s)", node->recirc_id, ofproto->up.name, + node->ofproto->up.name); + } + /* RCU postpone the free, since other threads may be referring * to 'node' at same time. */ ovsrcu_postpone(free, node); diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 6fb0dce30..4d484f8e7 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -240,8 +240,6 @@ AT_CHECK([ovs-ofctl add-flows br-int flows.txt]) # Should generate recirc_id(0x12d),dp_hash(0xcf/0xff). AT_CHECK([ovs-appctl netdev-dummy/receive p5 "in_port(5),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no)"]) -ovs-appctl time/warp 5000 100 - # Forces revalidators to update all stats. AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl megaflows disabled -- 2.20.1