Skip to content

Commit 98ba403

Browse files
Lai JiangshanJens Axboe
authored andcommitted
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: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent 68aee07 commit 98ba403

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎kernel/relay.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ void relay_reset(struct rchan *chan)
400400
}
401401

402402
mutex_lock(&relay_channels_mutex);
403-
for_each_online_cpu(i)
403+
for_each_possible_cpu(i)
404404
if (chan->buf[i])
405405
__relay_reset(chan->buf[i], 0);
406406
mutex_unlock(&relay_channels_mutex);
@@ -611,10 +611,9 @@ struct rchan *relay_open(const char *base_filename,
611611
return chan;
612612

613613
free_bufs:
614-
for_each_online_cpu(i) {
615-
if (!chan->buf[i])
616-
break;
617-
relay_close_buf(chan->buf[i]);
614+
for_each_possible_cpu(i) {
615+
if (chan->buf[i])
616+
relay_close_buf(chan->buf[i]);
618617
}
619618

620619
kref_put(&chan->kref, relay_destroy_channel);

0 commit comments

Comments
 (0)