Skip to content

Commit

Permalink
relay: fix cpu offline problem
Browse files Browse the repository at this point in the history
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: Lai Jiangshan <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Lai Jiangshan authored and Jens Axboe committed Nov 18, 2008
1 parent 68aee07 commit 98ba403
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kernel/relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 98ba403

Please sign in to comment.