mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
null_blk: fix error flow for shared tags during module_init
In case we use shared tags feature, blk_mq_alloc_tag_set might fail during module initialization. In that case, fail the load with a suitable error code. Also move the tagset initialization process after defining the amount of submission queues. Signed-off-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
615d22a51c
commit
db2d153d7a
1 changed files with 13 additions and 5 deletions
|
@ -844,9 +844,6 @@ static int __init null_init(void)
|
||||||
queue_mode = NULL_Q_MQ;
|
queue_mode = NULL_Q_MQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queue_mode == NULL_Q_MQ && shared_tags)
|
|
||||||
null_init_tag_set(&tag_set);
|
|
||||||
|
|
||||||
if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
|
if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
|
||||||
if (submit_queues < nr_online_nodes) {
|
if (submit_queues < nr_online_nodes) {
|
||||||
pr_warn("null_blk: submit_queues param is set to %u.",
|
pr_warn("null_blk: submit_queues param is set to %u.",
|
||||||
|
@ -858,11 +855,19 @@ static int __init null_init(void)
|
||||||
else if (!submit_queues)
|
else if (!submit_queues)
|
||||||
submit_queues = 1;
|
submit_queues = 1;
|
||||||
|
|
||||||
|
if (queue_mode == NULL_Q_MQ && shared_tags) {
|
||||||
|
ret = null_init_tag_set(&tag_set);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_init(&lock);
|
mutex_init(&lock);
|
||||||
|
|
||||||
null_major = register_blkdev(0, "nullb");
|
null_major = register_blkdev(0, "nullb");
|
||||||
if (null_major < 0)
|
if (null_major < 0) {
|
||||||
return null_major;
|
ret = null_major;
|
||||||
|
goto err_tagset;
|
||||||
|
}
|
||||||
|
|
||||||
if (use_lightnvm) {
|
if (use_lightnvm) {
|
||||||
ppa_cache = kmem_cache_create("ppa_cache", 64 * sizeof(u64),
|
ppa_cache = kmem_cache_create("ppa_cache", 64 * sizeof(u64),
|
||||||
|
@ -891,6 +896,9 @@ static int __init null_init(void)
|
||||||
kmem_cache_destroy(ppa_cache);
|
kmem_cache_destroy(ppa_cache);
|
||||||
err_ppa:
|
err_ppa:
|
||||||
unregister_blkdev(null_major, "nullb");
|
unregister_blkdev(null_major, "nullb");
|
||||||
|
err_tagset:
|
||||||
|
if (queue_mode == NULL_Q_MQ && shared_tags)
|
||||||
|
blk_mq_free_tag_set(&tag_set);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue