Skip to content

Commit 8a93664

Browse files
Weiping Pandavem330
authored andcommitted
bonding:record primary when modify it via sysfs
If we modify primary via sysfs and it is not a valid slave, we should record it for future use, and this behavior is the same with bond_check_params(). Signed-off-by: Weiping Pan <wpan@redhat.com> Acked-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5aa04d3 commit 8a93664

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/net/bonding/bond_sysfs.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,12 @@ static ssize_t bonding_store_primary(struct device *d,
10821082
}
10831083
}
10841084

1085-
pr_info("%s: Unable to set %.*s as primary slave.\n",
1086-
bond->dev->name, (int)strlen(buf) - 1, buf);
1085+
strncpy(bond->params.primary, ifname, IFNAMSIZ);
1086+
bond->params.primary[IFNAMSIZ - 1] = 0;
1087+
1088+
pr_info("%s: Recording %s as primary, "
1089+
"but it has not been enslaved to %s yet.\n",
1090+
bond->dev->name, ifname, bond->dev->name);
10871091
out:
10881092
write_unlock_bh(&bond->curr_slave_lock);
10891093
read_unlock(&bond->lock);

0 commit comments

Comments
 (0)