Skip to content

Commit 4bf485a

Browse files
Ming Leiaxboe
Ming Lei
authored andcommitted
blk-mq: register cpuhp callback after hctx is added to xarray table
We need to retrieve 'hctx' from xarray table in the cpuhp callback, so the callback should be registered after this 'hctx' is added to xarray table. Cc: Reinette Chatre <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Peter Newman <[email protected]> Cc: Babu Moger <[email protected]> Cc: Luck Tony <[email protected]> Signed-off-by: Ming Lei <[email protected]> Tested-by: Tony Luck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d64fd5f commit 4bf485a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

block/blk-mq.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,16 +3824,11 @@ static int blk_mq_init_hctx(struct request_queue *q,
38243824
{
38253825
hctx->queue_num = hctx_idx;
38263826

3827-
if (!(hctx->flags & BLK_MQ_F_STACKING))
3828-
cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE,
3829-
&hctx->cpuhp_online);
3830-
cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead);
3831-
38323827
hctx->tags = set->tags[hctx_idx];
38333828

38343829
if (set->ops->init_hctx &&
38353830
set->ops->init_hctx(hctx, set->driver_data, hctx_idx))
3836-
goto unregister_cpu_notifier;
3831+
goto fail;
38373832

38383833
if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx,
38393834
hctx->numa_node))
@@ -3842,6 +3837,11 @@ static int blk_mq_init_hctx(struct request_queue *q,
38423837
if (xa_insert(&q->hctx_table, hctx_idx, hctx, GFP_KERNEL))
38433838
goto exit_flush_rq;
38443839

3840+
if (!(hctx->flags & BLK_MQ_F_STACKING))
3841+
cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE,
3842+
&hctx->cpuhp_online);
3843+
cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead);
3844+
38453845
return 0;
38463846

38473847
exit_flush_rq:
@@ -3850,8 +3850,7 @@ static int blk_mq_init_hctx(struct request_queue *q,
38503850
exit_hctx:
38513851
if (set->ops->exit_hctx)
38523852
set->ops->exit_hctx(hctx, hctx_idx);
3853-
unregister_cpu_notifier:
3854-
blk_mq_remove_cpuhp(hctx);
3853+
fail:
38553854
return -1;
38563855
}
38573856

0 commit comments

Comments
 (0)