From patchwork Mon Jul 1 07:39:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 11025161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 556E11398 for ; Mon, 1 Jul 2019 07:40:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CB7126E98 for ; Mon, 1 Jul 2019 07:40:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA0E284FC; Mon, 1 Jul 2019 07:40:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8D6B26E98 for ; Mon, 1 Jul 2019 07:40:08 +0000 (UTC) Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id EABE861FBFD1; Mon, 1 Jul 2019 07:40:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org EABE861FBFD1 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id E357657E940E8; Mon, 1 Jul 2019 07:40:07 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 012EB57E940E6; Mon, 1 Jul 2019 07:40:04 +0000 (UTC) Received: from smtp-mm-osuosl01.fedoraproject.org (smtp-mm-osuosl01.vpn.fedoraproject.org [192.168.1.23]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D8E0A57E940E8 for ; Mon, 1 Jul 2019 07:40:03 +0000 (UTC) Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (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 A811198109 for ; Mon, 1 Jul 2019 07:40:03 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id cl9so6868690plb.10 for ; Mon, 01 Jul 2019 00:40:03 -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=NM89bQgiRLgPoYw5knfBEqtfBlSV0Ugq9mqV+5/q2kY=; b=f/U3mX+DqQVLT+ibDDueDnsb9AAJ5SzYciyHBU7pEBzTCFZYo//rJ6nD6Q1fG5emFP Kbzel2aw4oVI4vGWMU6Xe+B/6l1M0X3SPGZ08YTbDB1gOWXOHsOjB1ToNsdk49nPC3Dv v6vO+mAHG7yK/UnsUbQ//h6frGhv3CsU8dbcr0wU2ZCd4DUx/StX71g19HgHotNYvq10 BGY8GY3RLv0lQsKBarFdAJ1QWCwknK0WB4/2rwLhN5SsaHnCkgjHn6pjNFBB4+K7pESN Bh0wIQDMkOsadgLJECn1SinrJl5BsrYKDf8MsPWdlsV4dFqXUIWlZaH8HawnfT63tbH3 ptOw== X-Gm-Message-State: APjAAAXjYXtDMvRjuk0snRuH0LDzf4TeMGVQKOBkLvfrrSdt1tluoDbJ GLW5jc/2JAB1whtX0NwX3QzUtAU1 X-Google-Smtp-Source: APXvYqyGYdy3yf/zl6ye+t55t/SLoo/HogKwdEqy/JXRkjzTGwnrhNeOaDCR5Pz34aLhc+ScjEuqXA== X-Received: by 2002:a17:902:44a4:: with SMTP id l33mr27358962pld.174.1561966802962; Mon, 01 Jul 2019 00:40:02 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id h1sm14892418pfg.55.2019.07.01.00.40.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2019 00:40:02 -0700 (PDT) From: Xin Long To: libteam@lists.fedorahosted.org Subject: [PATCH] teamd: add port_master_ifindex_changed for link_watch_port_watch_ops Date: Mon, 1 Jul 2019 15:39:54 +0800 Message-Id: <2d632cd7b9a5246c78c84e0b077dde998fc31d73.1561966794.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 Message-ID-Hash: XQAYNOAAXGXLH2VPAILYUIEOMSBQZFCU X-Message-ID-Hash: XQAYNOAAXGXLH2VPAILYUIEOMSBQZFCU 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: Jiri Pirko , Hangbin Liu 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 X-Virus-Scanned: ClamAV using ClamSMTP This is a follow up of Commit b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for teamd_event_watch_ops") to fix the same issue in it. The issue is a race between option change event and ifinfo (master_ifindex) change event, so wherever a option change function tries to iterate tdport by teamd_for_each_tdport, the same thing should be done in its master_ifindex change function, including link_watch_port_watch_ops. The fix has been verified in one customer's env where it appeared no arp requests coming out on the only state-up tdport prior to this patch. Reported-by: Michal Tesar Fixes: b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for teamd_event_watch_ops") Signed-off-by: Xin Long --- teamd/teamd_link_watch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c index 019ec5d..62f8267 100644 --- a/teamd/teamd_link_watch.c +++ b/teamd/teamd_link_watch.c @@ -450,10 +450,19 @@ static int link_watch_enabled_option_changed(struct teamd_context *ctx, return link_watch_refresh_forced_send(ctx); } + +static int link_watch_port_master_ifindex_changed(struct teamd_context *ctx, + struct teamd_port *tdport, + void *priv) +{ + return link_watch_refresh_forced_send(ctx); +} + static const struct teamd_event_watch_ops link_watch_port_watch_ops = { .port_added = link_watch_event_watch_port_added, .port_removed = link_watch_event_watch_port_removed, .port_link_changed = link_watch_event_watch_port_link_changed, + .port_master_ifindex_changed = link_watch_port_master_ifindex_changed, .option_changed = link_watch_enabled_option_changed, .option_changed_match_name = "enabled", };