* Re: [PATCH] neighbour: Convert if statment in the function, neigh_add_timer to a WARN_ON
[not found] <1433188983-23207-1-git-send-email-xerofoify@gmail.com>
@ 2015-06-02 2:37 ` YOSHIFUJI Hideaki/吉藤英明
2015-06-02 3:37 ` Cong Wang
0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki/吉藤英明 @ 2015-06-02 2:37 UTC (permalink / raw)
To: Nicholas Krause, davem
Cc: hideaki.yoshifuji, ebiederm, edumazet, xiyou.wangcong, yoshfuji,
johannes.berg, nicolas.dichtel, netdev, linux-kernel
Nicholas Krause wrote:
> This converts the if statement for dumping the stack into a
> WARN_ON in order to make this function's debugging check
> simpler and have a cleaner output when this condition
> occurs inside this function for when bugs related to
> adding a duplicate neighbour table timer arise.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> net/core/neighbour.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 3de6542..0bf71da 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -165,11 +165,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
> static void neigh_add_timer(struct neighbour *n, unsigned long when)
> {
> neigh_hold(n);
> - if (unlikely(mod_timer(&n->timer, when))) {
> - printk("NEIGH: BUG, double timer add, state is %x\n",
> - n->nud_state);
> - dump_stack();
> - }
> + WARN_ON(unlikely(mod_timer(&n->timer, when)));
> }
NACK, please do not use WARN_ON for things with side effects.
--yoshfuji
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] neighbour: Convert if statment in the function, neigh_add_timer to a WARN_ON
2015-06-02 2:37 ` [PATCH] neighbour: Convert if statment in the function, neigh_add_timer to a WARN_ON YOSHIFUJI Hideaki/吉藤英明
@ 2015-06-02 3:37 ` Cong Wang
0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2015-06-02 3:37 UTC (permalink / raw)
To: YOSHIFUJI Hideaki/吉藤英明
Cc: Nicholas Krause, David Miller, Eric W. Biederman, Eric Dumazet,
Hideaki YOSHIFUJI, johannes.berg, Nicolas Dichtel,
Linux Kernel Network Developers, LKML
On Mon, Jun 1, 2015 at 7:37 PM, YOSHIFUJI Hideaki/吉藤英明
<hideaki.yoshifuji@miraclelinux.com> wrote:
> Nicholas Krause wrote:
>> This converts the if statement for dumping the stack into a
>> WARN_ON in order to make this function's debugging check
>> simpler and have a cleaner output when this condition
>> occurs inside this function for when bugs related to
>> adding a duplicate neighbour table timer arise.
>>
>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>> ---
>> net/core/neighbour.c | 6 +-----
>> 1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
>> index 3de6542..0bf71da 100644
>> --- a/net/core/neighbour.c
>> +++ b/net/core/neighbour.c
>> @@ -165,11 +165,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
>> static void neigh_add_timer(struct neighbour *n, unsigned long when)
>> {
>> neigh_hold(n);
>> - if (unlikely(mod_timer(&n->timer, when))) {
>> - printk("NEIGH: BUG, double timer add, state is %x\n",
>> - n->nud_state);
>> - dump_stack();
>> - }
>> + WARN_ON(unlikely(mod_timer(&n->timer, when)));
>> }
>
> NACK, please do not use WARN_ON for things with side effects.
Just:
int ret = mod_timer(...);
WARN_ON(ret);
...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-02 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1433188983-23207-1-git-send-email-xerofoify@gmail.com>
2015-06-02 2:37 ` [PATCH] neighbour: Convert if statment in the function, neigh_add_timer to a WARN_ON YOSHIFUJI Hideaki/吉藤英明
2015-06-02 3:37 ` Cong Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.