From patchwork Mon Sep 16 15:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 1162939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46X8xB3hHlz9sPn for ; Tue, 17 Sep 2019 01:17:17 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2E1221856; Mon, 16 Sep 2019 15:17:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 7BC951851 for ; Mon, 16 Sep 2019 15:17:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 31227828 for ; Mon, 16 Sep 2019 15:17:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CB753175282; Mon, 16 Sep 2019 15:16:59 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-122-83.rdu2.redhat.com [10.10.122.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEFC6600C1; Mon, 16 Sep 2019 15:16:58 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Mon, 16 Sep 2019 11:16:57 -0400 Message-Id: <20190916151657.25642-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 16 Sep 2019 15:16:59 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Marcelo Leitner Subject: [ovs-dev] [PATCH v2] vswitch: ratelimit the device add log X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org It's possible that a port added to the system with certain kinds of invalid parameters will cause the 'could not add' log to be triggered. When this happens, the vswitch run loop can continually re-attempt adding the port. While the parameters remain invalid the vswitch run loop will re-trigger the warning, flooding the syslog. This patch adds a simple rate limit to the log. Signed-off-by: Aaron Conole Acked-by: William Tu --- v2: set errp vswitchd/bridge.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index d921c4ef8..8c390382f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1816,8 +1816,13 @@ iface_do_create(const struct bridge *br, *ofp_portp = iface_pick_ofport(iface_cfg); error = ofproto_port_add(br->ofproto, netdev, ofp_portp); if (error) { - VLOG_WARN_BUF(errp, "could not add network device %s to ofproto (%s)", - iface_cfg->name, ovs_strerror(error)); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + + *errp = xasprintf("could not add network device %s to ofproto (%s)", + iface_cfg->name, ovs_strerror(error)); + if (!VLOG_DROP_WARN(&rl)) { + VLOG_WARN("%s", *errp); + } goto error; }