diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index ef8d2a080d17..3327a072e224 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -513,6 +513,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
513 | int new_value, ret = count; | 513 | int new_value, ret = count; |
514 | struct bonding *bond = to_bond(d); | 514 | struct bonding *bond = to_bond(d); |
515 | 515 | ||
516 | if (!rtnl_trylock()) | ||
517 | return restart_syscall(); | ||
516 | if (sscanf(buf, "%d", &new_value) != 1) { | 518 | if (sscanf(buf, "%d", &new_value) != 1) { |
517 | pr_err("%s: no arp_interval value specified.\n", | 519 | pr_err("%s: no arp_interval value specified.\n", |
518 | bond->dev->name); | 520 | bond->dev->name); |
@@ -539,10 +541,6 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
539 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 541 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
540 | bond->dev->name, bond->dev->name); | 542 | bond->dev->name, bond->dev->name); |
541 | bond->params.miimon = 0; | 543 | bond->params.miimon = 0; |
542 | if (delayed_work_pending(&bond->mii_work)) { | ||
543 | cancel_delayed_work(&bond->mii_work); | ||
544 | flush_workqueue(bond->wq); | ||
545 | } | ||
546 | } | 544 | } |
547 | if (!bond->params.arp_targets[0]) { | 545 | if (!bond->params.arp_targets[0]) { |
548 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | 546 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
@@ -554,19 +552,12 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
554 | * timer will get fired off when the open function | 552 | * timer will get fired off when the open function |
555 | * is called. | 553 | * is called. |
556 | */ | 554 | */ |
557 | if (!delayed_work_pending(&bond->arp_work)) { | 555 | cancel_delayed_work_sync(&bond->mii_work); |
558 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) | 556 | queue_delayed_work(bond->wq, &bond->arp_work, 0); |
559 | INIT_DELAYED_WORK(&bond->arp_work, | ||
560 | bond_activebackup_arp_mon); | ||
561 | else | ||
562 | INIT_DELAYED_WORK(&bond->arp_work, | ||
563 | bond_loadbalance_arp_mon); | ||
564 | |||
565 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
566 | } | ||
567 | } | 557 | } |
568 | 558 | ||
569 | out: | 559 | out: |
560 | rtnl_unlock(); | ||
570 | return ret; | 561 | return ret; |
571 | } | 562 | } |
572 | static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR, | 563 | static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR, |
@@ -962,6 +953,8 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
962 | int new_value, ret = count; | 953 | int new_value, ret = count; |
963 | struct bonding *bond = to_bond(d); | 954 | struct bonding *bond = to_bond(d); |
964 | 955 | ||
956 | if (!rtnl_trylock()) | ||
957 | return restart_syscall(); | ||
965 | if (sscanf(buf, "%d", &new_value) != 1) { | 958 | if (sscanf(buf, "%d", &new_value) != 1) { |
966 | pr_err("%s: no miimon value specified.\n", | 959 | pr_err("%s: no miimon value specified.\n", |
967 | bond->dev->name); | 960 | bond->dev->name); |
@@ -993,10 +986,6 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
993 | bond->params.arp_validate = | 986 | bond->params.arp_validate = |
994 | BOND_ARP_VALIDATE_NONE; | 987 | BOND_ARP_VALIDATE_NONE; |
995 | } | 988 | } |
996 | if (delayed_work_pending(&bond->arp_work)) { | ||
997 | cancel_delayed_work(&bond->arp_work); | ||
998 | flush_workqueue(bond->wq); | ||
999 | } | ||
1000 | } | 989 | } |
1001 | 990 | ||
1002 | if (bond->dev->flags & IFF_UP) { | 991 | if (bond->dev->flags & IFF_UP) { |
@@ -1005,15 +994,12 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1005 | * timer will get fired off when the open function | 994 | * timer will get fired off when the open function |
1006 | * is called. | 995 | * is called. |
1007 | */ | 996 | */ |
1008 | if (!delayed_work_pending(&bond->mii_work)) { | 997 | cancel_delayed_work_sync(&bond->arp_work); |
1009 | INIT_DELAYED_WORK(&bond->mii_work, | 998 | queue_delayed_work(bond->wq, &bond->mii_work, 0); |
1010 | bond_mii_monitor); | ||
1011 | queue_delayed_work(bond->wq, | ||
1012 | &bond->mii_work, 0); | ||
1013 | } | ||
1014 | } | 999 | } |
1015 | } | 1000 | } |
1016 | out: | 1001 | out: |
1002 | rtnl_unlock(); | ||
1017 | return ret; | 1003 | return ret; |
1018 | } | 1004 | } |
1019 | static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR, | 1005 | static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR, |