Skip to content

Commit 39eb810

Browse files
committed
Merge tag 'nvme-6.16-2025-05-20' of git://git.infradead.org/nvme into for-6.16/block
Pull NVMe updates from Christoph: "nvme updates for Linux 6.16 - add per-node DMA pools and use them for PRP/SGL allocations (Caleb Sander Mateos, Keith Busch) - nvme-fcloop refcounting fixes (Daniel Wagner) - support delayed removal of the multipath node and optionally support the multipath node for private namespaces (Nilay Shroff) - support shared CQs in the PCI endpoint target code (Wilfred Mallawa) - support admin-queue only authentication (Hannes Reinecke) - use the crc32c library instead of the crypto API (Eric Biggers) - misc cleanups (Christoph Hellwig, Marcelo Moreira, Hannes Reinecke, Leon Romanovsky, Gustavo A. R. Silva)" * tag 'nvme-6.16-2025-05-20' of git://git.infradead.org/nvme: (42 commits) nvme: rename nvme_mpath_shutdown_disk to nvme_mpath_remove_disk nvme: introduce multipath_always_on module param nvme-multipath: introduce delayed removal of the multipath head node nvme-pci: derive and better document max segments limits nvme-pci: use struct_size for allocation struct nvme_dev nvme-pci: add a symolic name for the small pool size nvme-pci: use a better encoding for small prp pool allocations nvme-pci: rename the descriptor pools nvme-pci: remove struct nvme_descriptor nvme-pci: store aborted state in flags variable nvme-pci: don't try to use SGLs for metadata on the admin queue nvme-pci: make PRP list DMA pools per-NUMA-node nvme-pci: factor out a nvme_init_hctx_common() helper dmapool: add NUMA affinity support nvme-fc: do not reference lsrsp after failure nvmet-fcloop: don't wait for lport cleanup nvmet-fcloop: add missing fcloop_callback_host_done nvmet-fc: take tgtport refs for portentry nvmet-fc: free pending reqs on tgtport unregister nvmet-fcloop: drop response if targetport is gone ...
2 parents 496a3bc + 9e221d8 commit 39eb810

File tree

23 files changed

+1001
-526
lines changed

23 files changed

+1001
-526
lines changed

drivers/nvme/common/auth.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
242242
{
243243
const char *hmac_name;
244244
struct crypto_shash *key_tfm;
245-
struct shash_desc *shash;
245+
SHASH_DESC_ON_STACK(shash, key_tfm);
246246
struct nvme_dhchap_key *transformed_key;
247247
int ret, key_len;
248248

@@ -267,19 +267,11 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
267267
if (IS_ERR(key_tfm))
268268
return ERR_CAST(key_tfm);
269269

270-
shash = kmalloc(sizeof(struct shash_desc) +
271-
crypto_shash_descsize(key_tfm),
272-
GFP_KERNEL);
273-
if (!shash) {
274-
ret = -ENOMEM;
275-
goto out_free_key;
276-
}
277-
278270
key_len = crypto_shash_digestsize(key_tfm);
279271
transformed_key = nvme_auth_alloc_key(key_len, key->hash);
280272
if (!transformed_key) {
281273
ret = -ENOMEM;
282-
goto out_free_shash;
274+
goto out_free_key;
283275
}
284276

285277
shash->tfm = key_tfm;
@@ -299,15 +291,12 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
299291
if (ret < 0)
300292
goto out_free_transformed_key;
301293

302-
kfree(shash);
303294
crypto_free_shash(key_tfm);
304295

305296
return transformed_key;
306297

307298
out_free_transformed_key:
308299
nvme_auth_free_key(transformed_key);
309-
out_free_shash:
310-
kfree(shash);
311300
out_free_key:
312301
crypto_free_shash(key_tfm);
313302

drivers/nvme/host/auth.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct nvme_dhchap_queue_context {
3131
u32 s1;
3232
u32 s2;
3333
bool bi_directional;
34+
bool authenticated;
3435
u16 transaction;
3536
u8 status;
3637
u8 dhgroup_id;
@@ -682,6 +683,7 @@ static void nvme_auth_reset_dhchap(struct nvme_dhchap_queue_context *chap)
682683
static void nvme_auth_free_dhchap(struct nvme_dhchap_queue_context *chap)
683684
{
684685
nvme_auth_reset_dhchap(chap);
686+
chap->authenticated = false;
685687
if (chap->shash_tfm)
686688
crypto_free_shash(chap->shash_tfm);
687689
if (chap->dh_tfm)
@@ -930,12 +932,14 @@ static void nvme_queue_auth_work(struct work_struct *work)
930932
}
931933
if (!ret) {
932934
chap->error = 0;
935+
chap->authenticated = true;
933936
if (ctrl->opts->concat &&
934937
(ret = nvme_auth_secure_concat(ctrl, chap))) {
935938
dev_warn(ctrl->device,
936939
"%s: qid %d failed to enable secure concatenation\n",
937940
__func__, chap->qid);
938941
chap->error = ret;
942+
chap->authenticated = false;
939943
}
940944
return;
941945
}
@@ -1023,21 +1027,30 @@ static void nvme_ctrl_auth_work(struct work_struct *work)
10231027
return;
10241028

10251029
for (q = 1; q < ctrl->queue_count; q++) {
1026-
ret = nvme_auth_negotiate(ctrl, q);
1027-
if (ret) {
1028-
dev_warn(ctrl->device,
1029-
"qid %d: error %d setting up authentication\n",
1030-
q, ret);
1031-
break;
1032-
}
1030+
struct nvme_dhchap_queue_context *chap =
1031+
&ctrl->dhchap_ctxs[q];
1032+
/*
1033+
* Skip re-authentication if the queue had
1034+
* not been authenticated initially.
1035+
*/
1036+
if (!chap->authenticated)
1037+
continue;
1038+
cancel_work_sync(&chap->auth_work);
1039+
queue_work(nvme_auth_wq, &chap->auth_work);
10331040
}
10341041

10351042
/*
10361043
* Failure is a soft-state; credentials remain valid until
10371044
* the controller terminates the connection.
10381045
*/
10391046
for (q = 1; q < ctrl->queue_count; q++) {
1040-
ret = nvme_auth_wait(ctrl, q);
1047+
struct nvme_dhchap_queue_context *chap =
1048+
&ctrl->dhchap_ctxs[q];
1049+
if (!chap->authenticated)
1050+
continue;
1051+
flush_work(&chap->auth_work);
1052+
ret = chap->error;
1053+
nvme_auth_reset_dhchap(chap);
10411054
if (ret)
10421055
dev_warn(ctrl->device,
10431056
"qid %d: authentication failed\n", q);
@@ -1076,6 +1089,7 @@ int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
10761089
chap = &ctrl->dhchap_ctxs[i];
10771090
chap->qid = i;
10781091
chap->ctrl = ctrl;
1092+
chap->authenticated = false;
10791093
INIT_WORK(&chap->auth_work, nvme_queue_auth_work);
10801094
}
10811095

drivers/nvme/host/core.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static void nvme_free_ns_head(struct kref *ref)
668668
struct nvme_ns_head *head =
669669
container_of(ref, struct nvme_ns_head, ref);
670670

671-
nvme_mpath_remove_disk(head);
671+
nvme_mpath_put_disk(head);
672672
ida_free(&head->subsys->ns_ida, head->instance);
673673
cleanup_srcu_struct(&head->srcu);
674674
nvme_put_subsystem(head->subsys);
@@ -3743,7 +3743,7 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_ctrl *ctrl,
37433743
*/
37443744
if (h->ns_id != nsid || !nvme_is_unique_nsid(ctrl, h))
37453745
continue;
3746-
if (!list_empty(&h->list) && nvme_tryget_ns_head(h))
3746+
if (nvme_tryget_ns_head(h))
37473747
return h;
37483748
}
37493749

@@ -3987,7 +3987,8 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
39873987
}
39883988
} else {
39893989
ret = -EINVAL;
3990-
if (!info->is_shared || !head->shared) {
3990+
if ((!info->is_shared || !head->shared) &&
3991+
!list_empty(&head->list)) {
39913992
dev_err(ctrl->device,
39923993
"Duplicate unshared namespace %d\n",
39933994
info->nsid);
@@ -4191,7 +4192,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
41914192
mutex_lock(&ns->ctrl->subsys->lock);
41924193
list_del_rcu(&ns->siblings);
41934194
if (list_empty(&ns->head->list)) {
4194-
list_del_init(&ns->head->entry);
4195+
if (!nvme_mpath_queue_if_no_path(ns->head))
4196+
list_del_init(&ns->head->entry);
41954197
last_path = true;
41964198
}
41974199
mutex_unlock(&ns->ctrl->subsys->lock);
@@ -4212,7 +4214,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
42124214
synchronize_srcu(&ns->ctrl->srcu);
42134215

42144216
if (last_path)
4215-
nvme_mpath_shutdown_disk(ns->head);
4217+
nvme_mpath_remove_disk(ns->head);
42164218
nvme_put_ns(ns);
42174219
}
42184220

drivers/nvme/host/fc.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,9 +1410,8 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)
14101410
}
14111411

14121412
static void
1413-
nvme_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
1413+
nvme_fc_xmt_ls_rsp_free(struct nvmefc_ls_rcv_op *lsop)
14141414
{
1415-
struct nvmefc_ls_rcv_op *lsop = lsrsp->nvme_fc_private;
14161415
struct nvme_fc_rport *rport = lsop->rport;
14171416
struct nvme_fc_lport *lport = rport->lport;
14181417
unsigned long flags;
@@ -1433,6 +1432,14 @@ nvme_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
14331432
nvme_fc_rport_put(rport);
14341433
}
14351434

1435+
static void
1436+
nvme_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
1437+
{
1438+
struct nvmefc_ls_rcv_op *lsop = lsrsp->nvme_fc_private;
1439+
1440+
nvme_fc_xmt_ls_rsp_free(lsop);
1441+
}
1442+
14361443
static void
14371444
nvme_fc_xmt_ls_rsp(struct nvmefc_ls_rcv_op *lsop)
14381445
{
@@ -1450,7 +1457,7 @@ nvme_fc_xmt_ls_rsp(struct nvmefc_ls_rcv_op *lsop)
14501457
dev_warn(lport->dev,
14511458
"LLDD rejected LS RSP xmt: LS %d status %d\n",
14521459
w0->ls_cmd, ret);
1453-
nvme_fc_xmt_ls_rsp_done(lsop->lsrsp);
1460+
nvme_fc_xmt_ls_rsp_free(lsop);
14541461
return;
14551462
}
14561463
}

0 commit comments

Comments
 (0)