Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2624678yba; Fri, 10 May 2019 15:21:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6R3a1BgZRdJtsoTJlj6OTlzbqzjC7QriSYjbWaSCLC8Ubn56Z9wjLFgz7egoSeCgCP36s X-Received: by 2002:a63:2bc8:: with SMTP id r191mr16463221pgr.72.1557526907409; Fri, 10 May 2019 15:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557526907; cv=none; d=google.com; s=arc-20160816; b=iL2xIDxcTRa2OQv9lbK8x4os2RbQzvF0JesgCqW/TpyOKp5jtgRi79hUpCWiUAQ5Y5 xZnsdXerdHnx2KbTcRY0WMC9z1R9mNVpl6n05BdADPFsHTYymktl/4sbA79BAbRNBj6O SfaRisthJ0N6edJFwX/RYtlqPMRDpCirtK73p2NjSTPzADg68gN7vwIhpAl3z8devMlq WZ6T24boVCWj9UreyRPW6rme/DwqWyJfy4eJtWD4EJ5npOG5z1XIgfXdwqfUHgro9K8W qpgbRfXG8P6c1QUfmo9M4KUc3fbm8DPPn5zFchF/qTgNhJGdYKewk9PNQX1C9b8+70FX oqJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ZTsvSS/txxdwL/YNX15zW+7ip/0n9Mxu278G1o1kCls=; b=huIAknnU3m4V1dm2G+pShhDwoOtVJhuuRarB5XgdE+jl2q0SpAZwb+kNBv391A8GZ9 HK6KGG6ess62xisfQHQ6HS2GSQ7VJ0QN7CkAdZrTSFB0llhSH7MKV0D9tQYrc78F4yZU kOD8OL3hAugQKBWibMLdOZ4PKmzfbxrZ/i1VIow9yCDE0Hn7xQXF5kKm4crJy3Q07hww xUzfOtqGQ8RlT4UkMMjoUTK4ZBUnsW//7vA5YSR4LjaK0iE089IbLNgr7vjbWOGqg+QB s5YQyt47bMRwLKrapXMQakvPvkqqn+lDjguc6OgZ/kxgfz0K6NMvFQB9NjE9+vxqwh+p XY7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u74si9887097pgc.346.2019.05.10.15.21.31; Fri, 10 May 2019 15:21:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728269AbfEJV5k (ORCPT + 99 others); Fri, 10 May 2019 17:57:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43302 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbfEJV5j (ORCPT ); Fri, 10 May 2019 17:57:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F87C307D913; Fri, 10 May 2019 21:57:39 +0000 (UTC) Received: from hp-dl360pgen8-07.khw2.lab.eng.bos.redhat.com (hp-dl360pgen8-07.khw2.lab.eng.bos.redhat.com [10.16.210.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id C82941A267; Fri, 10 May 2019 21:57:35 +0000 (UTC) From: Jarod Wilson To: linux-kernel@vger.kernel.org Cc: Jarod Wilson , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH] bonding: fix arp_validate toggling in active-backup mode Date: Fri, 10 May 2019 17:57:09 -0400 Message-Id: <20190510215709.19162-1-jarod@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 10 May 2019 21:57:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's currently a problem with toggling arp_validate on and off with an active-backup bond. At the moment, you can start up a bond, like so: modprobe bonding mode=1 arp_interval=100 arp_validate=0 arp_ip_targets=192.168.1.1 ip link set bond0 down echo "ens4f0" > /sys/class/net/bond0/bonding/slaves echo "ens4f1" > /sys/class/net/bond0/bonding/slaves ip link set bond0 up ip addr add 192.168.1.2/24 dev bond0 Pings to 192.168.1.1 work just fine. Now turn on arp_validate: echo 1 > /sys/class/net/bond0/bonding/arp_validate Pings to 192.168.1.1 continue to work just fine. Now when you go to turn arp_validate off again, the link falls flat on it's face: echo 0 > /sys/class/net/bond0/bonding/arp_validate dmesg ... [133191.911987] bond0: Setting arp_validate to none (0) [133194.257793] bond0: bond_should_notify_peers: slave ens4f0 [133194.258031] bond0: link status definitely down for interface ens4f0, disabling it [133194.259000] bond0: making interface ens4f1 the new active one [133197.330130] bond0: link status definitely down for interface ens4f1, disabling it [133197.331191] bond0: now running without any active interface! The problem lies in bond_options.c, where passing in arp_validate=0 results in bond->recv_probe getting set to NULL. This flies directly in the face of commit 3fe68df97c7f, which says we need to set recv_probe = bond_arp_recv, even if we're not using arp_validate. Said commit fixed this in bond_option_arp_interval_set, but missed that we can get to that same state in bond_option_arp_validate_set as well. One solution would be to universally set recv_probe = bond_arp_recv here as well, but I don't think bond_option_arp_validate_set has any business touching recv_probe at all, and that should be left to the arp_interval code, so we can just make things much tidier here. Fixes: 3fe68df97c7f ("bonding: always set recv_probe to bond_arp_rcv in arp monitor") CC: Jay Vosburgh CC: Veaceslav Falico CC: Andy Gospodarek CC: "David S. Miller" CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson --- drivers/net/bonding/bond_options.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index da1fc17295d9..b996967af8d9 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -1098,13 +1098,6 @@ static int bond_option_arp_validate_set(struct bonding *bond, { netdev_dbg(bond->dev, "Setting arp_validate to %s (%llu)\n", newval->string, newval->value); - - if (bond->dev->flags & IFF_UP) { - if (!newval->value) - bond->recv_probe = NULL; - else if (bond->params.arp_interval) - bond->recv_probe = bond_arp_rcv; - } bond->params.arp_validate = newval->value; return 0; -- 2.20.1