From cfd5c9eb1d9e94222d954b7f52040cd111b6640e Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Fri, 12 Jul 2013 16:56:55 -0700 Subject: [PATCH] ofproto-dpif: Zero-out subfacet counters when installation fails. When deleting subfacets, subfacet_uninstall() asserts that the subfacet's counters are zero to make sure we don't lose counters. We have seen cases where a subfacet cannot be installed, but the counters have values. This should not happen and indicates a bug, since we shouldn't create a subfacet if the datapath has a flow. A buggy datapath could trigger this, so just zero out the counters and log an error. Bug #18460. Signed-off-by: Justin Pettit --- ofproto/ofproto-dpif.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 67e6c7a19..283336c0e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3760,6 +3760,18 @@ handle_miss_upcalls(struct dpif_backer *backer, struct dpif_upcall *upcalls, COVERAGE_INC(subfacet_install_fail); + /* Zero-out subfacet counters when installation failed, but + * datapath reported hits. This should not happen and + * indicates a bug, since if the datapath flow exists, we + * should not be attempting to create a new subfacet. A + * buggy datapath could trigger this, so just zero out the + * counters and log an error. */ + if (subfacet->dp_packet_count || subfacet->dp_byte_count) { + VLOG_ERR_RL(&rl, "failed to install subfacet for which " + "datapath reported hits"); + subfacet->dp_packet_count = subfacet->dp_byte_count = 0; + } + subfacet->path = SF_NOT_INSTALLED; } -- 2.43.0