Skip to content
Snippets Groups Projects
  1. Dec 08, 2020
    • Jarod Wilson's avatar
      bonding: fix feature flag setting at init time · 007ab534
      Jarod Wilson authored
      
      Don't try to adjust XFRM support flags if the bond device isn't yet
      registered. Bad things can currently happen when netdev_change_features()
      is called without having wanted_features fully filled in yet. This code
      runs both on post-module-load mode changes, as well as at module init
      time, and when run at module init time, it is before register_netdevice()
      has been called and filled in wanted_features. The empty wanted_features
      led to features also getting emptied out, which was definitely not the
      intended behavior, so prevent that from happening.
      
      Originally, I'd hoped to stop adjusting wanted_features at all in the
      bonding driver, as it's documented as being something only the network
      core should touch, but we actually do need to do this to properly update
      both the features and wanted_features fields when changing the bond type,
      or we get to a situation where ethtool sees:
      
          esp-hw-offload: off [requested on]
      
      I do think we should be using netdev_update_features instead of
      netdev_change_features here though, so we only send notifiers when the
      features actually changed.
      
      Fixes: a3b658cf ("bonding: allow xfrm offload setup post-module-load")
      Reported-by: default avatarIvan Vecera <ivecera@redhat.com>
      Suggested-by: default avatarIvan Vecera <ivecera@redhat.com>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Link: https://lore.kernel.org/r/20201205172229.576587-1-jarod@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      007ab534
  2. Jul 01, 2020
    • Jarod Wilson's avatar
      bonding: allow xfrm offload setup post-module-load · a3b658cf
      Jarod Wilson authored
      
      At the moment, bonding xfrm crypto offload can only be set up if the bonding
      module is loaded with active-backup mode already set. We need to be able to
      make this work with bonds set to AB after the bonding driver has already
      been loaded.
      
      So what's done here is:
      
      1) move #define BOND_XFRM_FEATURES to net/bonding.h so it can be used
      by both bond_main.c and bond_options.c
      2) set BOND_XFRM_FEATURES in bond_dev->hw_features universally, rather than
      only when loading in AB mode
      3) wire up xfrmdev_ops universally too
      4) disable BOND_XFRM_FEATURES in bond_dev->features if not AB
      5) exit early (non-AB case) from bond_ipsec_offload_ok, to prevent a
      performance hit from traversing into the underlying drivers
      5) toggle BOND_XFRM_FEATURES in bond_dev->wanted_features and call
      netdev_change_features() from bond_option_mode_set()
      
      In my local testing, I can change bonding modes back and forth on the fly,
      have hardware offload work when I'm in AB, and see no performance penalty
      to non-AB software encryption, despite having xfrm bits all wired up for
      all modes now.
      
      Fixes: 18cb261a ("bonding: support hardware encryption offload to slaves")
      Reported-by: default avatarHuy Nguyen <huyn@mellanox.com>
      CC: Saeed Mahameed <saeedm@mellanox.com>
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3b658cf
  3. Jun 09, 2020
    • Cong Wang's avatar
      net: change addr_list_lock back to static key · 845e0ebb
      Cong Wang authored
      
      The dynamic key update for addr_list_lock still causes troubles,
      for example the following race condition still exists:
      
      CPU 0:				CPU 1:
      (RCU read lock)			(RTNL lock)
      dev_mc_seq_show()		netdev_update_lockdep_key()
      				  -> lockdep_unregister_key()
       -> netif_addr_lock_bh()
      
      because lockdep doesn't provide an API to update it atomically.
      Therefore, we have to move it back to static keys and use subclass
      for nest locking like before.
      
      In commit 1a33e10e ("net: partially revert dynamic lockdep key
      changes"), I already reverted most parts of commit ab92d68f
      ("net: core: add generic lockdep keys").
      
      This patch reverts the rest and also part of commit f3b0a18b
      ("net: remove unnecessary variables and callback"). After this
      patch, addr_list_lock changes back to using static keys and
      subclasses to satisfy lockdep. Thanks to dev->lower_level, we do
      not have to change back to ->ndo_get_lock_subclass().
      
      And hopefully this reduces some syzbot lockdep noises too.
      
      Reported-by: default avatar <syzbot+f3a0e80c34b3fc28ac5e@syzkaller.appspotmail.com>
      Cc: Taehee Yoo <ap420073@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      845e0ebb
  4. Feb 17, 2020
    • Taehee Yoo's avatar
      bonding: add missing netdev_update_lockdep_key() · 064ff66e
      Taehee Yoo authored
      
      After bond_release(), netdev_update_lockdep_key() should be called.
      But both ioctl path and attribute path don't call
      netdev_update_lockdep_key().
      This patch adds missing netdev_update_lockdep_key().
      
      Test commands:
          ip link add bond0 type bond
          ip link add bond1 type bond
          ifenslave bond0 bond1
          ifenslave -d bond0 bond1
          ifenslave bond1 bond0
      
      Splat looks like:
      [   29.501182][ T1046] WARNING: possible circular locking dependency detected
      [   29.501945][ T1039] hardirqs last disabled at (1962): [<ffffffffac6c807f>] handle_mm_fault+0x13f/0x700
      [   29.503442][ T1046] 5.5.0+ #322 Not tainted
      [   29.503447][ T1046] ------------------------------------------------------
      [   29.504277][ T1039] softirqs last  enabled at (1180): [<ffffffffade00678>] __do_softirq+0x678/0x981
      [   29.505443][ T1046] ifenslave/1046 is trying to acquire lock:
      [   29.505886][ T1039] softirqs last disabled at (1169): [<ffffffffac19c18a>] irq_exit+0x17a/0x1a0
      [   29.509997][ T1046] ffff88805d5da280 (&dev->addr_list_lock_key#3){+...}, at: dev_mc_sync_multiple+0x95/0x120
      [   29.511243][ T1046]
      [   29.511243][ T1046] but task is already holding lock:
      [   29.512192][ T1046] ffff8880460f2280 (&dev->addr_list_lock_key#4){+...}, at: bond_enslave+0x4482/0x47b0 [bonding]
      [   29.514124][ T1046]
      [   29.514124][ T1046] which lock already depends on the new lock.
      [   29.514124][ T1046]
      [   29.517297][ T1046]
      [   29.517297][ T1046] the existing dependency chain (in reverse order) is:
      [   29.518231][ T1046]
      [   29.518231][ T1046] -> #1 (&dev->addr_list_lock_key#4){+...}:
      [   29.519076][ T1046]        _raw_spin_lock+0x30/0x70
      [   29.519588][ T1046]        dev_mc_sync_multiple+0x95/0x120
      [   29.520208][ T1046]        bond_enslave+0x448d/0x47b0 [bonding]
      [   29.520862][ T1046]        bond_option_slaves_set+0x1a3/0x370 [bonding]
      [   29.521640][ T1046]        __bond_opt_set+0x1ff/0xbb0 [bonding]
      [   29.522438][ T1046]        __bond_opt_set_notify+0x2b/0xf0 [bonding]
      [   29.523251][ T1046]        bond_opt_tryset_rtnl+0x92/0xf0 [bonding]
      [   29.524082][ T1046]        bonding_sysfs_store_option+0x8a/0xf0 [bonding]
      [   29.524959][ T1046]        kernfs_fop_write+0x276/0x410
      [   29.525620][ T1046]        vfs_write+0x197/0x4a0
      [   29.526218][ T1046]        ksys_write+0x141/0x1d0
      [   29.526818][ T1046]        do_syscall_64+0x99/0x4f0
      [   29.527430][ T1046]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [   29.528265][ T1046]
      [   29.528265][ T1046] -> #0 (&dev->addr_list_lock_key#3){+...}:
      [   29.529272][ T1046]        __lock_acquire+0x2d8d/0x3de0
      [   29.529935][ T1046]        lock_acquire+0x164/0x3b0
      [   29.530638][ T1046]        _raw_spin_lock+0x30/0x70
      [   29.531187][ T1046]        dev_mc_sync_multiple+0x95/0x120
      [   29.531790][ T1046]        bond_enslave+0x448d/0x47b0 [bonding]
      [   29.532451][ T1046]        bond_option_slaves_set+0x1a3/0x370 [bonding]
      [   29.533163][ T1046]        __bond_opt_set+0x1ff/0xbb0 [bonding]
      [   29.533789][ T1046]        __bond_opt_set_notify+0x2b/0xf0 [bonding]
      [   29.534595][ T1046]        bond_opt_tryset_rtnl+0x92/0xf0 [bonding]
      [   29.535500][ T1046]        bonding_sysfs_store_option+0x8a/0xf0 [bonding]
      [   29.536379][ T1046]        kernfs_fop_write+0x276/0x410
      [   29.537057][ T1046]        vfs_write+0x197/0x4a0
      [   29.537640][ T1046]        ksys_write+0x141/0x1d0
      [   29.538251][ T1046]        do_syscall_64+0x99/0x4f0
      [   29.538870][ T1046]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [   29.539659][ T1046]
      [   29.539659][ T1046] other info that might help us debug this:
      [   29.539659][ T1046]
      [   29.540953][ T1046]  Possible unsafe locking scenario:
      [   29.540953][ T1046]
      [   29.541883][ T1046]        CPU0                    CPU1
      [   29.542540][ T1046]        ----                    ----
      [   29.543209][ T1046]   lock(&dev->addr_list_lock_key#4);
      [   29.543880][ T1046]                                lock(&dev->addr_list_lock_key#3);
      [   29.544873][ T1046]                                lock(&dev->addr_list_lock_key#4);
      [   29.545863][ T1046]   lock(&dev->addr_list_lock_key#3);
      [   29.546525][ T1046]
      [   29.546525][ T1046]  *** DEADLOCK ***
      [   29.546525][ T1046]
      [   29.547542][ T1046] 5 locks held by ifenslave/1046:
      [   29.548196][ T1046]  #0: ffff88806044c478 (sb_writers#5){.+.+}, at: vfs_write+0x3bb/0x4a0
      [   29.549248][ T1046]  #1: ffff88805af00890 (&of->mutex){+.+.}, at: kernfs_fop_write+0x1cf/0x410
      [   29.550343][ T1046]  #2: ffff88805b8b54b0 (kn->count#157){.+.+}, at: kernfs_fop_write+0x1f2/0x410
      [   29.551575][ T1046]  #3: ffffffffaecf4cf0 (rtnl_mutex){+.+.}, at: bond_opt_tryset_rtnl+0x5f/0xf0 [bonding]
      [   29.552819][ T1046]  #4: ffff8880460f2280 (&dev->addr_list_lock_key#4){+...}, at: bond_enslave+0x4482/0x47b0 [bonding]
      [   29.554175][ T1046]
      [   29.554175][ T1046] stack backtrace:
      [   29.554907][ T1046] CPU: 0 PID: 1046 Comm: ifenslave Not tainted 5.5.0+ #322
      [   29.555854][ T1046] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      [   29.557064][ T1046] Call Trace:
      [   29.557504][ T1046]  dump_stack+0x96/0xdb
      [   29.558054][ T1046]  check_noncircular+0x371/0x450
      [   29.558723][ T1046]  ? print_circular_bug.isra.35+0x310/0x310
      [   29.559486][ T1046]  ? hlock_class+0x130/0x130
      [   29.560100][ T1046]  ? __lock_acquire+0x2d8d/0x3de0
      [   29.560761][ T1046]  __lock_acquire+0x2d8d/0x3de0
      [   29.561366][ T1046]  ? register_lock_class+0x14d0/0x14d0
      [   29.562045][ T1046]  ? find_held_lock+0x39/0x1d0
      [   29.562641][ T1046]  lock_acquire+0x164/0x3b0
      [   29.563199][ T1046]  ? dev_mc_sync_multiple+0x95/0x120
      [   29.563872][ T1046]  _raw_spin_lock+0x30/0x70
      [   29.564464][ T1046]  ? dev_mc_sync_multiple+0x95/0x120
      [   29.565146][ T1046]  dev_mc_sync_multiple+0x95/0x120
      [   29.565793][ T1046]  bond_enslave+0x448d/0x47b0 [bonding]
      [   29.566487][ T1046]  ? bond_update_slave_arr+0x940/0x940 [bonding]
      [   29.567279][ T1046]  ? bstr_printf+0xc20/0xc20
      [   29.567857][ T1046]  ? stack_trace_consume_entry+0x160/0x160
      [   29.568614][ T1046]  ? deactivate_slab.isra.77+0x2c5/0x800
      [   29.569320][ T1046]  ? check_chain_key+0x236/0x5d0
      [   29.569939][ T1046]  ? sscanf+0x93/0xc0
      [   29.570442][ T1046]  ? vsscanf+0x1e20/0x1e20
      [   29.571003][ T1046]  bond_option_slaves_set+0x1a3/0x370 [bonding]
      [ ... ]
      
      Fixes: ab92d68f ("net: core: add generic lockdep keys")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      064ff66e
  5. Jul 04, 2019
    • Vincent Bernat's avatar
      bonding: add an option to specify a delay between peer notifications · 07a4ddec
      Vincent Bernat authored
      
      Currently, gratuitous ARP/ND packets are sent every `miimon'
      milliseconds. This commit allows a user to specify a custom delay
      through a new option, `peer_notif_delay'.
      
      Like for `updelay' and `downdelay', this delay should be a multiple of
      `miimon' to avoid managing an additional work queue. The configuration
      logic is copied from `updelay' and `downdelay'. However, the default
      value cannot be set using a module parameter: Netlink or sysfs should
      be used to configure this feature.
      
      When setting `miimon' to 100 and `peer_notif_delay' to 500, we can
      observe the 500 ms delay is respected:
      
          20:30:19.354693 ARP, Request who-has 203.0.113.10 tell 203.0.113.10, length 28
          20:30:19.874892 ARP, Request who-has 203.0.113.10 tell 203.0.113.10, length 28
          20:30:20.394919 ARP, Request who-has 203.0.113.10 tell 203.0.113.10, length 28
          20:30:20.914963 ARP, Request who-has 203.0.113.10 tell 203.0.113.10, length 28
      
      In bond_mii_monitor(), I have tried to keep the lock logic readable.
      The change is due to the fact we cannot rely on a notification to
      lower the value of `bond->send_peer_notif' as `NETDEV_NOTIFY_PEERS' is
      only triggered once every N times, while we need to decrement the
      counter each time.
      
      iproute2 also needs to be updated to be able to specify this new
      attribute through `ip link'.
      
      Signed-off-by: default avatarVincent Bernat <vincent@bernat.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07a4ddec
  6. Jun 09, 2019
  7. May 30, 2019
  8. May 13, 2019
    • Jarod Wilson's avatar
      bonding: fix arp_validate toggling in active-backup mode · a9b8a2b3
      Jarod Wilson authored
      
      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 3fe68df9, 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: 3fe68df9 ("bonding: always set recv_probe to bond_arp_rcv in arp monitor")
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: netdev@vger.kernel.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a9b8a2b3
  9. Feb 14, 2019
  10. Jul 21, 2018
    • Jarod Wilson's avatar
      bonding: set default miimon value for non-arp modes if not set · c1f897ce
      Jarod Wilson authored
      
      For some time now, if you load the bonding driver and configure bond
      parameters via sysfs using minimal config options, such as specifying
      nothing but the mode, relying on defaults for everything else, modes
      that cannot use arp monitoring (802.3ad, balance-tlb, balance-alb) all
      wind up with both arp_interval=0 (as it should be) and miimon=0, which
      means the miimon monitor thread never actually runs. This is particularly
      problematic for 802.3ad.
      
      For example, from an LNST recipe I've set up:
      
      $ modprobe bonding max_bonds=0"
      $ echo "+t_bond0" > /sys/class/net/bonding_masters"
      $ ip link set t_bond0 down"
      $ echo "802.3ad" > /sys/class/net/t_bond0/bonding/mode"
      $ ip link set ens1f1 down"
      $ echo "+ens1f1" > /sys/class/net/t_bond0/bonding/slaves"
      $ ip link set ens1f0 down"
      $ echo "+ens1f0" > /sys/class/net/t_bond0/bonding/slaves"
      $ ethtool -i t_bond0"
      $ ip link set ens1f1 up"
      $ ip link set ens1f0 up"
      $ ip link set t_bond0 up"
      $ ip addr add 192.168.9.1/24 dev t_bond0"
      $ ip addr add 2002::1/64 dev t_bond0"
      
      This bond comes up okay, but things look slightly suspect in
      /proc/net/bonding/t_bond0 output:
      
      $ grep -i mii /proc/net/bonding/t_bond0
      MII Status: up
      MII Polling Interval (ms): 0
      MII Status: up
      MII Status: up
      
      Now, pull a cable on one of the ports in the bond, then reconnect it, and
      you'll see:
      
      Slave Interface: ens1f0
      MII Status: down
      Speed: 1000 Mbps
      Duplex: full
      
      I believe this became a major issue as of commit 4d2c0cda, which for
      802.3ad bonds, sets slave->link = BOND_LINK_DOWN, with a comment about
      relying on link monitoring via miimon to set it correctly, but since the
      miimon work queue never runs, the link just stays marked down.
      
      If we simply tweak bond_option_mode_set() slightly, we can check for the
      non-arp modes having no miimon value set, and insert BOND_DEFAULT_MIIMON,
      which gets things back in full working order. This problem exists as far
      back as 4.14, and might be worth fixing in all stable trees since, though
      the work-around is to simply specify an miimon value yourself.
      
      Reported-by: default avatarBob Ball <ball@umich.edu>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Acked-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1f897ce
  11. Jun 07, 2018
  12. May 16, 2018
  13. Dec 20, 2017
  14. Oct 05, 2017
  15. Sep 11, 2017
    • Kosuke Tatsukawa's avatar
      net: bonding: Fix transmit load balancing in balance-alb mode if specified by sysfs · c6644d07
      Kosuke Tatsukawa authored
      
      Commit cbf5ecb3 ("net: bonding: Fix transmit load balancing in
      balance-alb mode") tried to fix transmit dynamic load balancing in
      balance-alb mode, which wasn't working after commit 8b426dc5
      ("bonding: remove hardcoded value").
      
      It turned out that my previous patch only fixed the case when
      balance-alb was specified as bonding module parameter, and not when
      balance-alb mode was set using /sys/class/net/*/bonding/mode (the most
      common usage).  In the latter case, tlb_dynamic_lb was set up according
      to the default mode of the bonding interface, which happens to be
      balance-rr.
      
      This additional patch addresses this issue by setting up tlb_dynamic_lb
      to 1 if "mode" is set to balance-alb through the sysfs interface.
      
      I didn't add code to change tlb_balance_lb back to the default value for
      other modes, because "mode" is usually set up only once during
      initialization, and it's not worthwhile to change the static variable
      bonding_defaults in bond_main.c to a global variable just for this
      purpose.
      
      Commit 8b426dc5 also changes the value of tlb_dynamic_lb for
      balance-tlb mode if it is set up using the sysfs interface.  I didn't
      change that behavior, because the value of tlb_balance_lb can be changed
      using the sysfs interface for balance-tlb, and I didn't like changing
      the default value back and forth for balance-tlb.
      
      As for balance-alb, /sys/class/net/*/bonding/tlb_balance_lb cannot be
      written to.  However, I think balance-alb with tlb_dynamic_lb set to 0
      is not an intended usage, so there is little use making it writable at
      this moment.
      
      Fixes: 8b426dc5 ("bonding: remove hardcoded value")
      Reported-by: default avatarReinis Rozitis <r@roze.lv>
      Signed-off-by: default avatarKosuke Tatsukawa <tatsu@ab.jp.nec.com>
      Cc: stable@vger.kernel.org  # v4.12+
      Acked-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Acked-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6644d07
  16. Jun 29, 2017
  17. May 27, 2017
    • Vlad Yasevich's avatar
      bonding: Prevent duplicate userspace notification · 7a7e96e0
      Vlad Yasevich authored
      
      Whenever a user changes bonding options, a NETDEV_CHANGEINFODATA
      notificatin is generated which results in a rtnelink message to
      be sent.  While runnig 'ip monitor', we can actually see 2 messages,
      one a result of the event, and the other a result of state change
      that is generated bo netdev_state_change().  However, this is not
      always the case. If bonding changes were done via sysfs or ifenslave
      (old ioctl interface), then only 1 message is seen.
      
      This patch removes duplicate messages in the case of using netlink
      to configure bonding.  It introduceds a separte function that
      triggers a netdev event and uses that function in the syfs and ioctl
      cases.
      
      This was discovered while auditing all the different envents and
      continues the effort of cleaning up duplicated netlink messages.
      
      CC: David Ahern <dsa@cumulusnetworks.com>
      CC: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarVladislav Yasevich <vyasevic@redhat.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a7e96e0
  18. Mar 02, 2017
  19. Feb 11, 2016
  20. Feb 09, 2016
  21. Aug 30, 2015
  22. Jul 27, 2015
  23. May 18, 2015
    • Nicolas Dichtel's avatar
      rtnl/bond: don't send rtnl msg for unregistered iface · ed2a80ab
      Nicolas Dichtel authored
      
      Before the patch, the command 'ip link add bond2 type bond mode 802.3ad'
      causes the kernel to send a rtnl message for the bond2 interface, with an
      ifindex 0.
      
      'ip monitor' shows:
      0: bond2: <BROADCAST,MULTICAST,MASTER> mtu 1500 state DOWN group default
          link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
      9: bond2@NONE: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default
          link/ether ea:3e:1f:53:92:7b brd ff:ff:ff:ff:ff:ff
      [snip]
      
      The patch fixes the spotted bug by checking in bond driver if the interface
      is registered before calling the notifier chain.
      It also adds a check in rtmsg_ifinfo() to prevent this kind of bug in the
      future.
      
      Fixes: d4261e56 ("bonding: create netlink event when bonding option is changed")
      CC: Jiri Pirko <jiri@resnulli.us>
      Reported-by: default avatarJulien Meunier <julien.meunier@6wind.com>
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed2a80ab
  24. May 11, 2015
  25. Jan 28, 2015
  26. Jan 12, 2015
    • Jonathan Toppins's avatar
      bonding: cleanup bond_opts array · 7bfa0145
      Jonathan Toppins authored
      
      Remove the empty array element initializer and size the array with
      BOND_OPT_LAST so the compiler will complain if more elements are in
      there than should be.
      
      An interesting unwanted side effect of this initializer is that if one
      inserts new options into the middle of the array then this initializer
      will zero out the option that equals BOND_OPT_TLB_DYNAMIC_LB+1.
      
      Example:
      Extend the OPTS enum:
      enum {
         ...
         BOND_OPT_TLB_DYNAMIC_LB,
         BOND_OPT_LACP_NEW1,
         BOND_OPT_LAST
      };
      
      Now insert into bond_opts array:
      static const struct bond_option bond_opts[] = {
            ...
            [BOND_OPT_LACP_RATE] = { .... unchanged stuff .... },
            [BOND_OPT_LACP_NEW1] = { ... new stuff ... },
            ...
            [BOND_OPT_TLB_DYNAMIC_LB] = { .... unchanged stuff ....},
            { } // MARK A
      };
      
      Since BOND_OPT_LACP_NEW1 = BOND_OPT_TLB_DYNAMIC_LB+1, the last
      initializer (MARK A) will overwrite the contents of BOND_OPT_LACP_NEW1
      and can be easily viewed with the crash utility.
      
      Signed-off-by: default avatarJonathan Toppins <jtoppins@cumulusnetworks.com>
      Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
      Cc: Nikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: default avatarAndy Gospodarek <gospo@cumulusnetworks.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7bfa0145
  27. Nov 10, 2014
  28. Sep 13, 2014
    • Nikolay Aleksandrov's avatar
      bonding: clean curr_slave_lock use · 1c72cfdc
      Nikolay Aleksandrov authored
      
      Mostly all users of curr_slave_lock already have RTNL as we've discussed
      previously so there's no point in using it, the one case where the lock
      must stay is the 3ad code, in fact it's the only one.
      It's okay to remove it from bond_do_fail_over_mac() as it's called with
      RTNL and drops the curr_slave_lock anyway.
      bond_change_active_slave() is one of the main places where
      curr_slave_lock was used, it's okay to remove it as all callers use RTNL
      these days before calling it, that's why we move the ASSERT_RTNL() in
      the beginning to catch any potential offenders to this rule.
      The RTNL argument actually applies to all of the places where
      curr_slave_lock has been removed from in this patch.
      Also remove the unnecessary bond_deref_active_protected() macro and use
      rtnl_dereference() instead.
      
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c72cfdc
  29. Sep 10, 2014
  30. Aug 22, 2014
  31. Jul 16, 2014
Loading