提交 98ba4031 编写于 作者: L Lai Jiangshan 提交者: Jens Axboe

relay: fix cpu offline problem

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.
Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 68aee07f
...@@ -400,7 +400,7 @@ void relay_reset(struct rchan *chan) ...@@ -400,7 +400,7 @@ void relay_reset(struct rchan *chan)
} }
mutex_lock(&relay_channels_mutex); mutex_lock(&relay_channels_mutex);
for_each_online_cpu(i) for_each_possible_cpu(i)
if (chan->buf[i]) if (chan->buf[i])
__relay_reset(chan->buf[i], 0); __relay_reset(chan->buf[i], 0);
mutex_unlock(&relay_channels_mutex); mutex_unlock(&relay_channels_mutex);
...@@ -611,9 +611,8 @@ struct rchan *relay_open(const char *base_filename, ...@@ -611,9 +611,8 @@ struct rchan *relay_open(const char *base_filename,
return chan; return chan;
free_bufs: free_bufs:
for_each_online_cpu(i) { for_each_possible_cpu(i) {
if (!chan->buf[i]) if (chan->buf[i])
break;
relay_close_buf(chan->buf[i]); relay_close_buf(chan->buf[i]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册