From patchwork Tue Sep 1 05:59:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 11747377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61D1F1575 for ; Tue, 1 Sep 2020 05:59:41 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion-iad01.fedoraproject.org [38.145.60.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 081CB2087D for ; Tue, 1 Sep 2020 05:59:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 081CB2087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.iad2.fedoraproject.org (mailman01.iad2.fedoraproject.org [10.3.163.57]) by bastion01.iad2.fedoraproject.org (Postfix) with ESMTP id DEC7430A55D5; Tue, 1 Sep 2020 05:59:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.iad2.fedoraproject.org DEC7430A55D5 Received: from mailman01.iad2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.iad2.fedoraproject.org (Postfix) with ESMTP id CEA615EF9F765; Tue, 1 Sep 2020 05:59:39 +0000 (UTC) Received: by mailman01.iad2.fedoraproject.org (Postfix, from userid 991) id 208915EF9F764; Tue, 1 Sep 2020 05:59:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.iad2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-osuosl01.fedoraproject.org (smtp-mm-osuosl01.vpn.fedoraproject.org [192.168.1.23]) by mailman01.iad2.fedoraproject.org (Postfix) with ESMTP id 851F85EF9F761 for ; Tue, 1 Sep 2020 05:59:36 +0000 (UTC) Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-osuosl01.fedoraproject.org (Postfix) with ESMTPS id 2053798062 for ; Tue, 1 Sep 2020 05:59:36 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id x18so8281pll.6 for ; Mon, 31 Aug 2020 22:59:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xyFlq/u0IxL+LBFvfhMjy93k3nuIePiyvk4Wi3l+OW0=; b=n0j02PvL3NRLOlRPv0XYNRT0rhunGH/nwfRHnQDHbvKpC9bj8uydXXGU89iBJ6AEhh GLDmehoFYH8l7wk4A4Eqzr5uSwBcZj6Gv69TieppVCTamh6ISGSvyAe3bW2ZQnD/X8AJ W0slWmlXr0y0LwLpSdirMpAJ3zv/ARx7IL8lyLLCyh2c8D1Z3CDvqXsG2kx/oPC5SiUC gRH1RQyiFGPGczzn7a/6/DZhyPPMfistO+KWya0cn4a0/LEORkYNgzX423aLTlhQ0mik savV3q8PrNsKqEATHgPfYog9XTBzKFcdFHKtzpxrWraLPl+j808vnBSx5gK/u1MTjadb eeJw== X-Gm-Message-State: AOAM531+z4/urOrjYIjK72NN1oCc83/hiy4FCqzekLiA/jfK7vzRVg4q TuY9sZMUSZMprxf2VarqDg6pahRK+24= X-Google-Smtp-Source: ABdhPJwAhizPEvzcHyJCve9C4aECklKZHkGfMb+PnyNq8pr3TuLSBWltABDDQzvKBCqgU3c33/EC4g== X-Received: by 2002:a17:90a:6e45:: with SMTP id s5mr66544pjm.12.1598939975198; Mon, 31 Aug 2020 22:59:35 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id q2sm550724pgs.90.2020.08.31.22.59.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2020 22:59:34 -0700 (PDT) From: Xin Long To: libteam@lists.fedorahosted.org Subject: [PATCH] Revert "teamd: Disregard current state when considering port enablement" Date: Tue, 1 Sep 2020 13:59:27 +0800 Message-Id: <68efe533b616cc1b76c6c14bbef354b1a52f4b08.1598939967.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 Message-ID-Hash: 2UN3S63KCUZNS2MJVI4TMQB3W4G4MPZE X-Message-ID-Hash: 2UN3S63KCUZNS2MJVI4TMQB3W4G4MPZE X-MailFrom: lucien.xin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Petr Machata , Dan Arena , Patrick Talbert , Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit deadb5b715227429a1879b187f5906b39151eca9. As Patrick noticed, with that commit, teamd_port_check_enable() would set the team port to the new state unconditionally, which triggers another change message from kernel to userspace, then teamd_port_check_enable() is called again to set the team port to the new state. This would go around and around to update the team port state, and even cause teamd to consume 100% cpu. As the issue caused by that commit is serious, it has to be reverted. As for the issued fixed by that commit, I would propose a new fix later. --- teamd/teamd_per_port.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c index 166da57..d429753 100644 --- a/teamd/teamd_per_port.c +++ b/teamd/teamd_per_port.c @@ -442,14 +442,18 @@ int teamd_port_check_enable(struct teamd_context *ctx, bool should_enable, bool should_disable) { bool new_enabled_state; + bool curr_enabled_state; int err; if (!teamd_port_present(ctx, tdport)) return 0; + err = teamd_port_enabled(ctx, tdport, &curr_enabled_state); + if (err) + return err; - if (should_enable) + if (!curr_enabled_state && should_enable) new_enabled_state = true; - else if (should_disable) + else if (curr_enabled_state && should_disable) new_enabled_state = false; else return 0;