aoe: error printed 1 too early
Subsystems (2)
PATCH 1/1 aoe: error printed 1 too early
with while (i-- > 0); i reaches -1 after the loop, so the test below is printed one too early: 0 still means success.
---
drivers/block/aoe/aoedev.c +1 -1
@@ -173,7 +173,7 @@ skbfree(struct sk_buff *skb)return ;while (atomic_read (&skb_shinfo (skb)->dataref) !=1 && i-- >0 )msleep (Sms); -if (i <=0 ) { +if (i <0 ) { printk(KERN_ERR "aoe: %s holds ref: %s\n", skb->dev ? skb->dev->name : "netif",
Quoted 11 lines · Roel Kluin
with while (i-- > 0); i reaches -1 after the loop, so the test below is printed one too early: 0 still means success.
Signed-off-by Roel Kluin <[email protected]>---
drivers/block/aoe/aoedev.c +0
-0
drivers/block/aoe/aoedev.c skbfree(struct sk_buff *skb) · line 179
Quoted 8 lines
drivers/block/aoe/aoedev.c +1
-1@@ -173,7 +173,7 @@ skbfree(struct sk_buff *skb)return ;while (atomic_read (&skb_shinfo (skb)->dataref) !=1 && i-- >0 )msleep (Sms); -if (i <=0 ) { +if (i <0 ) { printk(KERN_ERR "aoe: %s holds ref: %s\n", skb->dev ? skb->dev->name : "netif",
You are talking about the case where, when entering the loop on the "last chance" iteration, the states are,
atomic_read(&skb_shinfo(skb)->dataref == 1
i == 0
... in which case, the skb can and should be used but is not used because after the value of i is tested it becomes -1.
Right?
Sounds like a good catch. Did you find it because you saw the "cannot free skb" message?
Signature · 1 line
Ed Cashin <[email protected]>
From: Ed Cashin <[email protected]>
Date: Wed, 25 Feb 2009 12:09:02 -0500
Quoted 2 lines
Sounds like a good catch. Did you find it because you saw the "cannot free skb" message?
He's finding these by looking for them in the code, not by actually triggering the condition.
Quoted 8 lines · David Miller
From: Ed Cashin <[email protected]>
Date: Wed, 25 Feb 2009 12:09:02 -0500Quoted 2 lines
Sounds like a good catch. Did you find it because you saw the "cannot free skb" message?
He's finding these by looking for them in the code, not by actually triggering the condition.
Thanks. I was curious.
Signature · 1 line
Ed Cashin <[email protected]>
2009/2/25 David Miller <[email protected]>:
Quoted 9 lines
From: Ed Cashin <[email protected]>
Date: Wed, 25 Feb 2009 12:09:02 -0500Quoted 2 lines
Sounds like a good catch. Did you find it because you saw the "cannot free skb" message?
He's finding these by looking for them in the code, not by actually triggering the condition.
Actually I made all functions a single line and then run some bash scripts that parses pseudocode like:
echo "INFO: \7 reaches \9 - 1 after loop"
bli "
if \((${npz}[&|][&|])?
--($w) $em?[<=] ($K|$w|$d)
((&&|\|\|)$(nestedcode "()"))?\)
(\{
($(nestedcode "{}"))*
break ;
\}|
break ;
)
$ccode
(
$Q(\7 [=$em]= \9|\7 (>=|<) \9)
|
return \7 ;
)
"This gives me a match like:
while(...) {
if (--i < 0)
break;
...
}
...
if (i != 0)
...which is wrong since i reaches -1.
David Miller
AppliedFrom: Roel Kluin <[email protected]>
Date: Wed, 25 Feb 2009 14:38:54 +0100
Quoted 4 lines
with while (i-- > 0); i reaches -1 after the loop, so the test below is printed one too early: 0 still means success.
Signed-off-by Roel Kluin <[email protected]>
Applied, thanks.