Skip to content

Commit e02bbac

Browse files
committed
Merge tag 'nvme-6.2-2023-02-02' of git://git.infradead.org/nvme into block-6.2
Pul NVMe fixes from Christoph: "nvme fixes for Linux 6.2 - fix a missing queue put in nvmet_fc_ls_create_association (Amit Engel) - clear queue pointers on tag_set initialization failure (Maurizio Lombardi) - use workqueue dedicated to authentication (Shin'ichiro Kawasaki)" * tag 'nvme-6.2-2023-02-02' of git://git.infradead.org/nvme: nvme-auth: use workqueue dedicated to authentication nvme: clear the request_queue pointers on failure in nvme_alloc_io_tag_set nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association
2 parents 0416f3b + bd97a59 commit e02bbac

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

drivers/nvme/host/auth.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ struct nvme_dhchap_queue_context {
4545
int sess_key_len;
4646
};
4747

48+
struct workqueue_struct *nvme_auth_wq;
49+
4850
#define nvme_auth_flags_from_qid(qid) \
4951
(qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED
5052
#define nvme_auth_queue_from_qid(ctrl, qid) \
@@ -866,7 +868,7 @@ int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid)
866868

867869
chap = &ctrl->dhchap_ctxs[qid];
868870
cancel_work_sync(&chap->auth_work);
869-
queue_work(nvme_wq, &chap->auth_work);
871+
queue_work(nvme_auth_wq, &chap->auth_work);
870872
return 0;
871873
}
872874
EXPORT_SYMBOL_GPL(nvme_auth_negotiate);
@@ -1008,10 +1010,15 @@ EXPORT_SYMBOL_GPL(nvme_auth_free);
10081010

10091011
int __init nvme_init_auth(void)
10101012
{
1013+
nvme_auth_wq = alloc_workqueue("nvme-auth-wq",
1014+
WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
1015+
if (!nvme_auth_wq)
1016+
return -ENOMEM;
1017+
10111018
nvme_chap_buf_cache = kmem_cache_create("nvme-chap-buf-cache",
10121019
CHAP_BUF_SIZE, 0, SLAB_HWCACHE_ALIGN, NULL);
10131020
if (!nvme_chap_buf_cache)
1014-
return -ENOMEM;
1021+
goto err_destroy_workqueue;
10151022

10161023
nvme_chap_buf_pool = mempool_create(16, mempool_alloc_slab,
10171024
mempool_free_slab, nvme_chap_buf_cache);
@@ -1021,11 +1028,14 @@ int __init nvme_init_auth(void)
10211028
return 0;
10221029
err_destroy_chap_buf_cache:
10231030
kmem_cache_destroy(nvme_chap_buf_cache);
1031+
err_destroy_workqueue:
1032+
destroy_workqueue(nvme_auth_wq);
10241033
return -ENOMEM;
10251034
}
10261035

10271036
void __exit nvme_exit_auth(void)
10281037
{
10291038
mempool_destroy(nvme_chap_buf_pool);
10301039
kmem_cache_destroy(nvme_chap_buf_cache);
1040+
destroy_workqueue(nvme_auth_wq);
10311041
}

drivers/nvme/host/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4892,7 +4892,9 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48924892
blk_mq_destroy_queue(ctrl->admin_q);
48934893
blk_put_queue(ctrl->admin_q);
48944894
out_free_tagset:
4895-
blk_mq_free_tag_set(ctrl->admin_tagset);
4895+
blk_mq_free_tag_set(set);
4896+
ctrl->admin_q = NULL;
4897+
ctrl->fabrics_q = NULL;
48964898
return ret;
48974899
}
48984900
EXPORT_SYMBOL_GPL(nvme_alloc_admin_tag_set);
@@ -4954,6 +4956,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
49544956

49554957
out_free_tag_set:
49564958
blk_mq_free_tag_set(set);
4959+
ctrl->connect_q = NULL;
49574960
return ret;
49584961
}
49594962
EXPORT_SYMBOL_GPL(nvme_alloc_io_tag_set);

drivers/nvme/target/fc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,8 +1685,10 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
16851685
else {
16861686
queue = nvmet_fc_alloc_target_queue(iod->assoc, 0,
16871687
be16_to_cpu(rqst->assoc_cmd.sqsize));
1688-
if (!queue)
1688+
if (!queue) {
16891689
ret = VERR_QUEUE_ALLOC_FAIL;
1690+
nvmet_fc_tgt_a_put(iod->assoc);
1691+
}
16901692
}
16911693
}
16921694

0 commit comments

Comments
 (0)