All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Cashin <ecashin@coraid.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] aoe: error printed 1 too early
Date: Wed, 25 Feb 2009 12:09:02 -0500	[thread overview]
Message-ID: <20090225170901.GA26634@coraid.com> (raw)
In-Reply-To: <49A549EE.7020202@gmail.com>

On Wed, Feb 25, 2009 at 02:38:54PM +0100, Roel Kluin wrote:
> 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 <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
> index cc25057..eeea477 100644
> --- a/drivers/block/aoe/aoedev.c
> +++ b/drivers/block/aoe/aoedev.c
> @@ -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?

-- 
  Ed Cashin <ecashin@coraid.com>

  reply	other threads:[~2009-02-25 17:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 13:38 [PATCH] aoe: error printed 1 too early Roel Kluin
2009-02-25 17:09 ` Ed Cashin [this message]
2009-02-25 22:01   ` David Miller
2009-02-25 22:19     ` Ed Cashin
2009-02-25 22:29     ` roel kluin
2009-03-04  8:08 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090225170901.GA26634@coraid.com \
    --to=ecashin@coraid.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.