• Milos Vyletel's avatar
    bonding: unset primary slave via sysfs · eb492f74
    Milos Vyletel authored
    When bonding module is loaded with primary parameter and one decides to unset
    primary slave using sysfs these settings are not preserved during bond device
    restart. Primary slave is only unset once and it's not remembered in
    bond->params structure. Below is example of recreation.
    
     grep OPTS /etc/sysconfig/network-scripts/ifcfg-bond0
    BONDING_OPTS="mode=active-backup miimon=100 primary=eth01"
     grep "Primary Slave" /proc/net/bonding/bond0
    Primary Slave: eth01 (primary_reselect always)
    
     echo "" > /sys/class/net/bond0/bonding/primary
     grep "Primary Slave" /proc/net/bonding/bond0
    Primary Slave: None
    
     sed -i -e 's/primary=eth01//' /etc/sysconfig/network-scripts/ifcfg-bond0
     grep OPTS /etc/sysconfig/network-scripts/ifcfg-bond
    BONDING_OPTS="mode=active-backup miimon=100 "
     ifdown bond0 && ifup bond0
    
    without patch:
     grep "Primary Slave" /proc/net/bonding/bond0
    Primary Slave: eth01 (primary_reselect always)
    
    with patch:
     grep "Primary Slave" /proc/net/bonding/bond0
    Primary Slave: None
    Reviewed-by: default avatarJiri Pirko <jiri@resnulli.us>
    Signed-off-by: default avatarMilos Vyletel <milos.vyletel@sde.cz>
    Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    eb492f74
bond_sysfs.c 44.2 KB