diff options
author | nikolay@redhat.com <nikolay@redhat.com> | 2013-09-06 18:00:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-11 15:55:17 -0400 |
commit | 5bb9e0b50d2188d8fac481742d9f801436e2c5ab (patch) | |
tree | bdf506c0c2ccc9aabe07846151f4ac27b6473644 /drivers/net/bonding/bond_sysfs.c | |
parent | 5c5038dc26bdc609022a897e15f9ccdd28402ad9 (diff) |
bonding: fix bond_arp_rcv setting and arp validate desync state
We make bond_arp_rcv global so it can be used in bond_sysfs if the bond
interface is up and arp_interval is being changed to a positive value
and cleared otherwise as per Jay's suggestion.
This also fixes a problem where bond_arp_rcv was set even though
arp_validate was disabled while the bond was up by unsetting recv_probe
in bond_store_arp_validate and respectively setting it if enabled.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Acked-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 4e386836d34f..eeab40b01b7a 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -349,6 +349,8 @@ static ssize_t bonding_store_mode(struct device *d, | |||
349 | goto out; | 349 | goto out; |
350 | } | 350 | } |
351 | 351 | ||
352 | /* don't cache arp_validate between modes */ | ||
353 | bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; | ||
352 | bond->params.mode = new_value; | 354 | bond->params.mode = new_value; |
353 | bond_set_mode_ops(bond, bond->params.mode); | 355 | bond_set_mode_ops(bond, bond->params.mode); |
354 | pr_info("%s: setting mode to %s (%d).\n", | 356 | pr_info("%s: setting mode to %s (%d).\n", |
@@ -419,8 +421,8 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
419 | struct device_attribute *attr, | 421 | struct device_attribute *attr, |
420 | const char *buf, size_t count) | 422 | const char *buf, size_t count) |
421 | { | 423 | { |
422 | int new_value, ret = count; | ||
423 | struct bonding *bond = to_bond(d); | 424 | struct bonding *bond = to_bond(d); |
425 | int new_value, ret = count; | ||
424 | 426 | ||
425 | if (!rtnl_trylock()) | 427 | if (!rtnl_trylock()) |
426 | return restart_syscall(); | 428 | return restart_syscall(); |
@@ -431,7 +433,7 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
431 | ret = -EINVAL; | 433 | ret = -EINVAL; |
432 | goto out; | 434 | goto out; |
433 | } | 435 | } |
434 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 436 | if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) { |
435 | pr_err("%s: arp_validate only supported in active-backup mode.\n", | 437 | pr_err("%s: arp_validate only supported in active-backup mode.\n", |
436 | bond->dev->name); | 438 | bond->dev->name); |
437 | ret = -EINVAL; | 439 | ret = -EINVAL; |
@@ -441,6 +443,12 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
441 | bond->dev->name, arp_validate_tbl[new_value].modename, | 443 | bond->dev->name, arp_validate_tbl[new_value].modename, |
442 | new_value); | 444 | new_value); |
443 | 445 | ||
446 | if (bond->dev->flags & IFF_UP) { | ||
447 | if (!new_value) | ||
448 | bond->recv_probe = NULL; | ||
449 | else if (bond->params.arp_interval) | ||
450 | bond->recv_probe = bond_arp_rcv; | ||
451 | } | ||
444 | bond->params.arp_validate = new_value; | 452 | bond->params.arp_validate = new_value; |
445 | out: | 453 | out: |
446 | rtnl_unlock(); | 454 | rtnl_unlock(); |
@@ -561,8 +569,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
561 | struct device_attribute *attr, | 569 | struct device_attribute *attr, |
562 | const char *buf, size_t count) | 570 | const char *buf, size_t count) |
563 | { | 571 | { |
564 | int new_value, ret = count; | ||
565 | struct bonding *bond = to_bond(d); | 572 | struct bonding *bond = to_bond(d); |
573 | int new_value, ret = count; | ||
566 | 574 | ||
567 | if (!rtnl_trylock()) | 575 | if (!rtnl_trylock()) |
568 | return restart_syscall(); | 576 | return restart_syscall(); |
@@ -605,8 +613,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
605 | * is called. | 613 | * is called. |
606 | */ | 614 | */ |
607 | if (!new_value) { | 615 | if (!new_value) { |
616 | if (bond->params.arp_validate) | ||
617 | bond->recv_probe = NULL; | ||
608 | cancel_delayed_work_sync(&bond->arp_work); | 618 | cancel_delayed_work_sync(&bond->arp_work); |
609 | } else { | 619 | } else { |
620 | /* arp_validate can be set only in active-backup mode */ | ||
621 | if (bond->params.arp_validate) | ||
622 | bond->recv_probe = bond_arp_rcv; | ||
610 | cancel_delayed_work_sync(&bond->mii_work); | 623 | cancel_delayed_work_sync(&bond->mii_work); |
611 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 624 | queue_delayed_work(bond->wq, &bond->arp_work, 0); |
612 | } | 625 | } |