public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] relay: fix cpu offline problem
Date: Fri, 14 Nov 2008 10:41:55 +0100	[thread overview]
Message-ID: <20081114094154.GT26778@kernel.dk> (raw)
In-Reply-To: <491D45EB.5050307@cn.fujitsu.com>

On Fri, Nov 14 2008, Lai Jiangshan wrote:
> relay_open() will close allocated buffers when failed.
> but if cpu offlined, some buffer will not be closed.
> this patch fixed it.
> 
> and did cleanup for relay_reset() too.

Good catch, that definitely looks like a bug. Applied.

> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/relay.c b/kernel/relay.c
> index 8d13a78..32b0bef 100644
> --- a/kernel/relay.c
> +++ b/kernel/relay.c
> @@ -400,7 +400,7 @@ void relay_reset(struct rchan *chan)
>  	}
>  
>  	mutex_lock(&relay_channels_mutex);
> -	for_each_online_cpu(i)
> +	for_each_possible_cpu(i)
>  		if (chan->buf[i])
>  			__relay_reset(chan->buf[i], 0);
>  	mutex_unlock(&relay_channels_mutex);
> @@ -611,10 +611,9 @@ struct rchan *relay_open(const char *base_filename,
>  	return chan;
>  
>  free_bufs:
> -	for_each_online_cpu(i) {
> -		if (!chan->buf[i])
> -			break;
> -		relay_close_buf(chan->buf[i]);
> +	for_each_possible_cpu(i) {
> +		if (chan->buf[i])
> +			relay_close_buf(chan->buf[i]);
>  	}
>  
>  	kref_put(&chan->kref, relay_destroy_channel);
> 

-- 
Jens Axboe


  reply	other threads:[~2008-11-14  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14  9:33 [PATCH] relay: fix cpu offline problem Lai Jiangshan
2008-11-14  9:41 ` Jens Axboe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-09 16:25 [PATCH] Relay : " Mathieu Desnoyers
2008-12-10  0:33 ` Lai Jiangshan
2008-12-10  1:54   ` Mathieu Desnoyers

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=20081114094154.GT26778@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox