* [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
@ 2008-06-20 0:54 Wang Chen
2008-06-20 2:07 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Wang Chen @ 2008-06-20 0:54 UTC (permalink / raw)
To: David S. Miller; +Cc: Jeff Garzik, NETDEV, Jay Vosburgh, Patrick McHardy
dev_set_promiscuity/allmulti might overflow.
Commit: "netdevice: Fix promiscuity and allmulti overflow" in net-next makes
dev_set_promiscuity/allmulti return error number if overflow happened.
In bond_alb and bond_main, we check all positive increment for promiscuity
and allmulti to get error return.
But there are still two problems left.
1. Some callers want quiet handle.
2. If there are multi slaves, it's hard to tell which slaves increment
promisc/allmulti successfully and which failed.
So I left these problems to be FIXME.
Fortunately, the overflow is very rare case.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
drivers/net/bonding/bond_alb.c | 7 ++++-
drivers/net/bonding/bond_main.c | 41 +++++++++++++++++++++++++++++++-------
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 5a67372..26d49d8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
}
if (!bond->alb_info.primary_is_promisc) {
- bond->alb_info.primary_is_promisc = 1;
- dev_set_promiscuity(bond->curr_active_slave->dev, 1);
+ /* dev_set_promiscuity might overflow, check it here */
+ if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
+ bond->alb_info.primary_is_promisc = 1;
+ else
+ bond->alb_info.primary_is_promisc = 0;
}
bond->alb_info.rlb_promisc_timeout_counter = 0;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 50a40e4..f5e5550 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -762,39 +762,49 @@ static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct
/*
* Push the promiscuity flag down to appropriate slaves
*/
-static void bond_set_promiscuity(struct bonding *bond, int inc)
+static int bond_set_promiscuity(struct bonding *bond, int inc)
{
+ int err = 0;
if (USES_PRIMARY(bond->params.mode)) {
/* write lock already acquired */
if (bond->curr_active_slave) {
- dev_set_promiscuity(bond->curr_active_slave->dev, inc);
+ err = dev_set_promiscuity(bond->curr_active_slave->dev,
+ inc);
}
} else {
struct slave *slave;
int i;
bond_for_each_slave(bond, slave, i) {
- dev_set_promiscuity(slave->dev, inc);
+ err = dev_set_promiscuity(slave->dev, inc);
+ if (err)
+ return err;
}
}
+ return err;
}
/*
* Push the allmulti flag down to all slaves
*/
-static void bond_set_allmulti(struct bonding *bond, int inc)
+static int bond_set_allmulti(struct bonding *bond, int inc)
{
+ int err = 0;
if (USES_PRIMARY(bond->params.mode)) {
/* write lock already acquired */
if (bond->curr_active_slave) {
- dev_set_allmulti(bond->curr_active_slave->dev, inc);
+ err = dev_set_allmulti(bond->curr_active_slave->dev,
+ inc);
}
} else {
struct slave *slave;
int i;
bond_for_each_slave(bond, slave, i) {
- dev_set_allmulti(slave->dev, inc);
+ err = dev_set_allmulti(slave->dev, inc);
+ if (err)
+ return err;
}
}
+ return err;
}
/*
@@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
}
if (new_active) {
+ /* FIXME: promiscuity and allmulti might overflow,
+ * but bond_mc_swap's caller likes quiet handle.
+ */
if (bond->dev->flags & IFF_PROMISC) {
dev_set_promiscuity(new_active->dev, 1);
}
@@ -1456,12 +1469,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
if (!USES_PRIMARY(bond->params.mode)) {
/* set promiscuity level to new slave */
if (bond_dev->flags & IFF_PROMISC) {
- dev_set_promiscuity(slave_dev, 1);
+ res = dev_set_promiscuity(slave_dev, 1);
+ if (res)
+ goto err_close;
}
/* set allmulti level to new slave */
if (bond_dev->flags & IFF_ALLMULTI) {
- dev_set_allmulti(slave_dev, 1);
+ res = dev_set_allmulti(slave_dev, 1);
+ if (res)
+ goto err_close;
}
netif_tx_lock_bh(bond_dev);
@@ -3933,6 +3950,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
* Do promisc before checking multicast_mode
*/
if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) {
+ /*
+ * FIXME: If bond has multi slaves, how to handle the error
+ * when one of the slaves encounters promiscuity overflow.
+ */
bond_set_promiscuity(bond, 1);
}
@@ -3942,6 +3963,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
/* set allmulti flag to slaves */
if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) {
+ /*
+ * FIXME: If bond has multi slaves, how to handle the error
+ * when one of the slaves encounters allmulti overflow.
+ */
bond_set_allmulti(bond, 1);
}
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-20 0:54 [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti Wang Chen
@ 2008-06-20 2:07 ` David Miller
2008-06-20 2:56 ` Wang Chen
2008-06-21 18:19 ` Joe Eykholt
0 siblings, 2 replies; 7+ messages in thread
From: David Miller @ 2008-06-20 2:07 UTC (permalink / raw)
To: wangchen; +Cc: jgarzik, netdev, fubar, kaber
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 20 Jun 2008 08:54:42 +0800
> @@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
> }
>
> if (!bond->alb_info.primary_is_promisc) {
> - bond->alb_info.primary_is_promisc = 1;
> - dev_set_promiscuity(bond->curr_active_slave->dev, 1);
> + /* dev_set_promiscuity might overflow, check it here */
> + if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
Like the first patch, please don't add such comments.
> @@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
> }
>
> if (new_active) {
> + /* FIXME: promiscuity and allmulti might overflow,
> + * but bond_mc_swap's caller likes quiet handle.
> + */
> if (bond->dev->flags & IFF_PROMISC) {
> dev_set_promiscuity(new_active->dev, 1);
> }
Please reword this comment. The issue is that this code path has no
mechanism to signal errors upstream. It isn't about a specific type
of error condition in particular, it's about error handling capabilites
in general.
> @@ -3933,6 +3950,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
> * Do promisc before checking multicast_mode
> */
> if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) {
> + /*
> + * FIXME: If bond has multi slaves, how to handle the error
> + * when one of the slaves encounters promiscuity overflow.
> + */
> bond_set_promiscuity(bond, 1);
> }
>
Remove specific reference to promiscuity overflow, these are generic error
handling issues here regardless of the types of errors that the down
calls could encounter.
> @@ -3942,6 +3963,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
>
> /* set allmulti flag to slaves */
> if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) {
> + /*
> + * FIXME: If bond has multi slaves, how to handle the error
> + * when one of the slaves encounters allmulti overflow.
> + */
> bond_set_allmulti(bond, 1);
> }
Likewise.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-20 2:07 ` David Miller
@ 2008-06-20 2:56 ` Wang Chen
2008-06-21 18:19 ` Joe Eykholt
1 sibling, 0 replies; 7+ messages in thread
From: Wang Chen @ 2008-06-20 2:56 UTC (permalink / raw)
To: David Miller; +Cc: jgarzik, netdev, fubar, kaber
David Miller said the following on 2008-6-20 10:07:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Fri, 20 Jun 2008 08:54:42 +0800
>
>> @@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
>> }
>>
>> if (!bond->alb_info.primary_is_promisc) {
>> - bond->alb_info.primary_is_promisc = 1;
>> - dev_set_promiscuity(bond->curr_active_slave->dev, 1);
>> + /* dev_set_promiscuity might overflow, check it here */
>> + if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
>
> Like the first patch, please don't add such comments.
>
>> @@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
>> }
>>
>> if (new_active) {
>> + /* FIXME: promiscuity and allmulti might overflow,
>> + * but bond_mc_swap's caller likes quiet handle.
>> + */
>> if (bond->dev->flags & IFF_PROMISC) {
>> dev_set_promiscuity(new_active->dev, 1);
>> }
>
> Please reword this comment. The issue is that this code path has no
> mechanism to signal errors upstream. It isn't about a specific type
> of error condition in particular, it's about error handling capabilites
> in general.
>
>> @@ -3933,6 +3950,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
>> * Do promisc before checking multicast_mode
>> */
>> if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) {
>> + /*
>> + * FIXME: If bond has multi slaves, how to handle the error
>> + * when one of the slaves encounters promiscuity overflow.
>> + */
>> bond_set_promiscuity(bond, 1);
>> }
>>
>
> Remove specific reference to promiscuity overflow, these are generic error
> handling issues here regardless of the types of errors that the down
> calls could encounter.
>
>> @@ -3942,6 +3963,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
>>
>> /* set allmulti flag to slaves */
>> if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) {
>> + /*
>> + * FIXME: If bond has multi slaves, how to handle the error
>> + * when one of the slaves encounters allmulti overflow.
>> + */
>> bond_set_allmulti(bond, 1);
>> }
>
> Likewise.
>
dev_set_promiscuity/allmulti might overflow.
Commit: "netdevice: Fix promiscuity and allmulti overflow" in net-next makes
dev_set_promiscuity/allmulti return error number if overflow happened.
In bond_alb and bond_main, we check all positive increment for promiscuity
and allmulti to get error return.
But there are still two problems left.
1. Some code path has no mechanism to signal errors upstream.
2. If there are multi slaves, it's hard to tell which slaves increment
promisc/allmulti successfully and which failed.
So I left these problems to be FIXME.
Fortunately, the overflow is very rare case.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
drivers/net/bonding/bond_alb.c | 6 ++++--
drivers/net/bonding/bond_main.c | 39 +++++++++++++++++++++++++++++++--------
2 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 5a67372..b211486 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -419,8 +419,10 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
}
if (!bond->alb_info.primary_is_promisc) {
- bond->alb_info.primary_is_promisc = 1;
- dev_set_promiscuity(bond->curr_active_slave->dev, 1);
+ if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
+ bond->alb_info.primary_is_promisc = 1;
+ else
+ bond->alb_info.primary_is_promisc = 0;
}
bond->alb_info.rlb_promisc_timeout_counter = 0;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 50a40e4..fa3a06d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -762,39 +762,49 @@ static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct
/*
* Push the promiscuity flag down to appropriate slaves
*/
-static void bond_set_promiscuity(struct bonding *bond, int inc)
+static int bond_set_promiscuity(struct bonding *bond, int inc)
{
+ int err = 0;
if (USES_PRIMARY(bond->params.mode)) {
/* write lock already acquired */
if (bond->curr_active_slave) {
- dev_set_promiscuity(bond->curr_active_slave->dev, inc);
+ err = dev_set_promiscuity(bond->curr_active_slave->dev,
+ inc);
}
} else {
struct slave *slave;
int i;
bond_for_each_slave(bond, slave, i) {
- dev_set_promiscuity(slave->dev, inc);
+ err = dev_set_promiscuity(slave->dev, inc);
+ if (err)
+ return err;
}
}
+ return err;
}
/*
* Push the allmulti flag down to all slaves
*/
-static void bond_set_allmulti(struct bonding *bond, int inc)
+static int bond_set_allmulti(struct bonding *bond, int inc)
{
+ int err = 0;
if (USES_PRIMARY(bond->params.mode)) {
/* write lock already acquired */
if (bond->curr_active_slave) {
- dev_set_allmulti(bond->curr_active_slave->dev, inc);
+ err = dev_set_allmulti(bond->curr_active_slave->dev,
+ inc);
}
} else {
struct slave *slave;
int i;
bond_for_each_slave(bond, slave, i) {
- dev_set_allmulti(slave->dev, inc);
+ err = dev_set_allmulti(slave->dev, inc);
+ if (err)
+ return err;
}
}
+ return err;
}
/*
@@ -955,6 +965,7 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
}
if (new_active) {
+ /* FIXME: Signal errors upstream. */
if (bond->dev->flags & IFF_PROMISC) {
dev_set_promiscuity(new_active->dev, 1);
}
@@ -1456,12 +1467,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
if (!USES_PRIMARY(bond->params.mode)) {
/* set promiscuity level to new slave */
if (bond_dev->flags & IFF_PROMISC) {
- dev_set_promiscuity(slave_dev, 1);
+ res = dev_set_promiscuity(slave_dev, 1);
+ if (res)
+ goto err_close;
}
/* set allmulti level to new slave */
if (bond_dev->flags & IFF_ALLMULTI) {
- dev_set_allmulti(slave_dev, 1);
+ res = dev_set_allmulti(slave_dev, 1);
+ if (res)
+ goto err_close;
}
netif_tx_lock_bh(bond_dev);
@@ -3933,6 +3948,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
* Do promisc before checking multicast_mode
*/
if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) {
+ /*
+ * FIXME: Need to handle the error when one of the multi-slaves
+ * encounters error.
+ */
bond_set_promiscuity(bond, 1);
}
@@ -3942,6 +3961,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
/* set allmulti flag to slaves */
if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) {
+ /*
+ * FIXME: Need to handle the error when one of the multi-slaves
+ * encounters error.
+ */
bond_set_allmulti(bond, 1);
}
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-20 2:07 ` David Miller
2008-06-20 2:56 ` Wang Chen
@ 2008-06-21 18:19 ` Joe Eykholt
2008-06-23 1:36 ` Wang Chen
1 sibling, 1 reply; 7+ messages in thread
From: Joe Eykholt @ 2008-06-21 18:19 UTC (permalink / raw)
To: David Miller; +Cc: wangchen, jgarzik, netdev, fubar, kaber
David Miller wrote:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Fri, 20 Jun 2008 08:54:42 +0800
>
>> @@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
>> }
>>
>> if (!bond->alb_info.primary_is_promisc) {
>> - bond->alb_info.primary_is_promisc = 1;
>> - dev_set_promiscuity(bond->curr_active_slave->dev, 1);
>> + /* dev_set_promiscuity might overflow, check it here */
>> + if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
>
> Like the first patch, please don't add such comments.
>
>> @@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
>> }
>>
>> if (new_active) {
>> + /* FIXME: promiscuity and allmulti might overflow,
>> + * but bond_mc_swap's caller likes quiet handle.
>> + */
>> if (bond->dev->flags & IFF_PROMISC) {
>> dev_set_promiscuity(new_active->dev, 1);
>> }
>
> Please reword this comment. The issue is that this code path has no
> mechanism to signal errors upstream. It isn't about a specific type
> of error condition in particular, it's about error handling capabilites
> in general.
If netdev->promiscuity overflows, shouldn't there be a WARN_ON or BUG_ON
that catches that? Either someone forgot to clean up, or much less likely,
the counter needs to be widened. It isn't necessarily the current caller's
fault, but some indication of the problem is better than nothing.
>> @@ -3933,6 +3950,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
>> * Do promisc before checking multicast_mode
>> */
>> if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) {
>> + /*
>> + * FIXME: If bond has multi slaves, how to handle the error
>> + * when one of the slaves encounters promiscuity overflow.
>> + */
>> bond_set_promiscuity(bond, 1);
>> }
>>
>
> Remove specific reference to promiscuity overflow, these are generic error
> handling issues here regardless of the types of errors that the down
> calls could encounter.
>
>> @@ -3942,6 +3963,10 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
>>
>> /* set allmulti flag to slaves */
>> if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) {
>> + /*
>> + * FIXME: If bond has multi slaves, how to handle the error
>> + * when one of the slaves encounters allmulti overflow.
>> + */
>> bond_set_allmulti(bond, 1);
>> }
>
> Likewise.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-21 18:19 ` Joe Eykholt
@ 2008-06-23 1:36 ` Wang Chen
2008-06-23 3:55 ` Joe Eykholt
2008-06-23 11:13 ` Patrick McHardy
0 siblings, 2 replies; 7+ messages in thread
From: Wang Chen @ 2008-06-23 1:36 UTC (permalink / raw)
To: Joe Eykholt; +Cc: David Miller, jgarzik, netdev, fubar, kaber
Joe Eykholt said the following on 2008-6-22 2:19:
> David Miller wrote:
>> From: Wang Chen <wangchen@cn.fujitsu.com>
>> Date: Fri, 20 Jun 2008 08:54:42 +0800
>>
>>> @@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
>>> }
>>>
>>> if (!bond->alb_info.primary_is_promisc) {
>>> - bond->alb_info.primary_is_promisc = 1;
>>> - dev_set_promiscuity(bond->curr_active_slave->dev, 1);
>>> + /* dev_set_promiscuity might overflow, check it here */
>>> + if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
>> Like the first patch, please don't add such comments.
>>
>>> @@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
>>> }
>>>
>>> if (new_active) {
>>> + /* FIXME: promiscuity and allmulti might overflow,
>>> + * but bond_mc_swap's caller likes quiet handle.
>>> + */
>>> if (bond->dev->flags & IFF_PROMISC) {
>>> dev_set_promiscuity(new_active->dev, 1);
>>> }
>> Please reword this comment. The issue is that this code path has no
>> mechanism to signal errors upstream. It isn't about a specific type
>> of error condition in particular, it's about error handling capabilites
>> in general.
>
> If netdev->promiscuity overflows, shouldn't there be a WARN_ON or BUG_ON
> that catches that? Either someone forgot to clean up, or much less likely,
> the counter needs to be widened. It isn't necessarily the current caller's
> fault, but some indication of the problem is better than nothing.
>
If promiscuity overflows, dev_set_promiscuity will printk(KERN_WARNING) now.
Compare to that, WARN_ON has more information about modules info and dump stack.
But I think printk has enough information to indicate the problem and we
don't need WARN_ON.
How do you think?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-23 1:36 ` Wang Chen
@ 2008-06-23 3:55 ` Joe Eykholt
2008-06-23 11:13 ` Patrick McHardy
1 sibling, 0 replies; 7+ messages in thread
From: Joe Eykholt @ 2008-06-23 3:55 UTC (permalink / raw)
To: Wang Chen; +Cc: Joe Eykholt, David Miller, jgarzik, netdev, fubar, kaber
Wang Chen wrote:
> Joe Eykholt said the following on 2008-6-22 2:19:
>> David Miller wrote:
>>> From: Wang Chen <wangchen@cn.fujitsu.com>
>>> Date: Fri, 20 Jun 2008 08:54:42 +0800
>>>
>>>> @@ -419,8 +419,11 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
>>>> }
>>>>
>>>> if (!bond->alb_info.primary_is_promisc) {
>>>> - bond->alb_info.primary_is_promisc = 1;
>>>> - dev_set_promiscuity(bond->curr_active_slave->dev, 1);
>>>> + /* dev_set_promiscuity might overflow, check it here */
>>>> + if (!dev_set_promiscuity(bond->curr_active_slave->dev, 1))
>>> Like the first patch, please don't add such comments.
>>>
>>>> @@ -955,6 +965,9 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
>>>> }
>>>>
>>>> if (new_active) {
>>>> + /* FIXME: promiscuity and allmulti might overflow,
>>>> + * but bond_mc_swap's caller likes quiet handle.
>>>> + */
>>>> if (bond->dev->flags & IFF_PROMISC) {
>>>> dev_set_promiscuity(new_active->dev, 1);
>>>> }
>>> Please reword this comment. The issue is that this code path has no
>>> mechanism to signal errors upstream. It isn't about a specific type
>>> of error condition in particular, it's about error handling capabilites
>>> in general.
>> If netdev->promiscuity overflows, shouldn't there be a WARN_ON or BUG_ON
>> that catches that? Either someone forgot to clean up, or much less likely,
>> the counter needs to be widened. It isn't necessarily the current caller's
>> fault, but some indication of the problem is better than nothing.
>>
>
> If promiscuity overflows, dev_set_promiscuity will printk(KERN_WARNING) now.
> Compare to that, WARN_ON has more information about modules info and dump stack.
> But I think printk has enough information to indicate the problem and we
> don't need WARN_ON.
> How do you think?
I agree, printk is enough. If it is reproducible, the cause can be
determined. I didn't check to see there was a printk there.
Thanks,
Joe
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti
2008-06-23 1:36 ` Wang Chen
2008-06-23 3:55 ` Joe Eykholt
@ 2008-06-23 11:13 ` Patrick McHardy
1 sibling, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2008-06-23 11:13 UTC (permalink / raw)
To: Wang Chen; +Cc: Joe Eykholt, David Miller, jgarzik, netdev, fubar
Wang Chen wrote:
> Joe Eykholt said the following on 2008-6-22 2:19:
>> If netdev->promiscuity overflows, shouldn't there be a WARN_ON or BUG_ON
>> that catches that? Either someone forgot to clean up, or much less likely,
>> the counter needs to be widened. It isn't necessarily the current caller's
>> fault, but some indication of the problem is better than nothing.
>>
>
> If promiscuity overflows, dev_set_promiscuity will printk(KERN_WARNING) now.
> Compare to that, WARN_ON has more information about modules info and dump stack.
> But I think printk has enough information to indicate the problem and we
> don't need WARN_ON.
> How do you think?
WARN_ON doesn't provide any useful information here, if the counter
overflowed, its because *something else* increased it by too much.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-06-23 11:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20 0:54 [PATCH net-next 2/8] bonding: Check return of dev_set_promiscuity/allmulti Wang Chen
2008-06-20 2:07 ` David Miller
2008-06-20 2:56 ` Wang Chen
2008-06-21 18:19 ` Joe Eykholt
2008-06-23 1:36 ` Wang Chen
2008-06-23 3:55 ` Joe Eykholt
2008-06-23 11:13 ` Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).