From patchwork Thu Jun 10 22:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1490669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G1K1C4JP5z9sVm for ; Fri, 11 Jun 2021 08:49:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 518A560AB2; Thu, 10 Jun 2021 22:49:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rSRIEuU-To21; Thu, 10 Jun 2021 22:49:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id CDEE0605CA; Thu, 10 Jun 2021 22:49:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88460C000E; Thu, 10 Jun 2021 22:49:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id C8D20C000B for ; Thu, 10 Jun 2021 22:49:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AB27D4041D for ; Thu, 10 Jun 2021 22:49:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GTcTcCXwT1AR for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp2.osuosl.org (Postfix) with ESMTPS id 9176040202 for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) Received: (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id DC91A40004; Thu, 10 Jun 2021 22:49:37 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 10 Jun 2021 15:49:33 -0700 Message-Id: <20210610224934.2200271-1-blp@ovn.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 1/2] fail-open: Only fail open if we've been disconnected for at least 1 s. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The 'last_disconn_secs' member determines whether we're currently in fail-open mode (see fail_open_is_active()), but before this commit, fail_open_run() could decide to enter fail-open mode even if that would set 'last_disconn_secs' to 0 (and thus not really enter it). This could lead to an endless stream of log messages about entering fail-open mode, none of which actually does anything. This fixes the problem. (This patch worries me because this functionality has been stable and unchanged for many years and I wonder how something so simple is broken.) Signed-off-by: Ben Pfaff Acked-by: Ilya Maximets --- ofproto/fail-open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 5b105ba880a3..34b398ecae30 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -180,7 +180,7 @@ fail_open_run(struct fail_open *fo) int disconn_secs = connmgr_failure_duration(fo->connmgr); /* Enter fail-open mode if 'fo' is not in it but should be. */ - if (disconn_secs >= trigger_duration(fo)) { + if (disconn_secs > 0 && disconn_secs >= trigger_duration(fo)) { if (!fail_open_is_active(fo)) { VLOG_WARN("Could not connect to controller (or switch failed " "controller's post-connection admission control "