Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nvme-6.8-2024-02-01' of git://git.infradead.org/nvme into block-6.8

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.8

- Remove duplicated enums (Guixen)
- Use appropriate controller state accessors (Keith)
- Retryable authentication (Hannes)
- Add missing module descriptions (Chaitanya)
- Fibre-channel fixes for blktests (Daniel)
- Various type correctness updates (Caleb)
- Improve fabrics connection debugging prints (Nitin)
- Passthrough command verbose error logging (Adam)"

* tag 'nvme-6.8-2024-02-01' of git://git.infradead.org/nvme: (31 commits)
nvme: allow passthru cmd error logging
nvme-fc: show hostnqn when connecting to fc target
nvme-rdma: show hostnqn when connecting to rdma target
nvme-tcp: show hostnqn when connecting to tcp target
nvmet-fc: use RCU list iterator for assoc_list
nvmet-fc: take ref count on tgtport before delete assoc
nvmet-fc: avoid deadlock on delete association path
nvmet-fc: abort command when there is no binding
nvmet-fc: do not tack refs on tgtports from assoc
nvmet-fc: remove null hostport pointer check
nvmet-fc: hold reference on hostport match
nvmet-fc: free queue and assoc directly
nvmet-fc: defer cleanup using RCU properly
nvmet-fc: release reference on target port
nvmet-fcloop: swap the list_add_tail arguments
nvme-fc: do not wait in vain when unloading module
nvme-fc: log human-readable opcode on timeout
nvme: split out fabrics version of nvme_opcode_str()
nvme: take const cmd pointer in read-only helpers
nvme: remove redundant status mask
...

+380 -236
+1
drivers/nvme/common/auth.c
··· 471 471 } 472 472 EXPORT_SYMBOL_GPL(nvme_auth_generate_key); 473 473 474 + MODULE_DESCRIPTION("NVMe Authentication framework"); 474 475 MODULE_LICENSE("GPL v2");
+1
drivers/nvme/common/keyring.c
··· 181 181 182 182 MODULE_LICENSE("GPL v2"); 183 183 MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>"); 184 + MODULE_DESCRIPTION("NVMe Keyring implementation"); 184 185 module_init(nvme_keyring_init); 185 186 module_exit(nvme_keyring_exit);
+7 -6
drivers/nvme/host/apple.c
··· 797 797 798 798 static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown) 799 799 { 800 + enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl); 800 801 u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS); 801 802 bool dead = false, freeze = false; 802 803 unsigned long flags; ··· 809 808 if (csts & NVME_CSTS_CFS) 810 809 dead = true; 811 810 812 - if (anv->ctrl.state == NVME_CTRL_LIVE || 813 - anv->ctrl.state == NVME_CTRL_RESETTING) { 811 + if (state == NVME_CTRL_LIVE || 812 + state == NVME_CTRL_RESETTING) { 814 813 freeze = true; 815 814 nvme_start_freeze(&anv->ctrl); 816 815 } ··· 882 881 unsigned long flags; 883 882 u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS); 884 883 885 - if (anv->ctrl.state != NVME_CTRL_LIVE) { 884 + if (nvme_ctrl_state(&anv->ctrl) != NVME_CTRL_LIVE) { 886 885 /* 887 886 * From rdma.c: 888 887 * If we are resetting, connecting or deleting we should ··· 986 985 u32 boot_status, aqa; 987 986 struct apple_nvme *anv = 988 987 container_of(work, struct apple_nvme, ctrl.reset_work); 988 + enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl); 989 989 990 - if (anv->ctrl.state != NVME_CTRL_RESETTING) { 991 - dev_warn(anv->dev, "ctrl state %d is not RESETTING\n", 992 - anv->ctrl.state); 990 + if (state != NVME_CTRL_RESETTING) { 991 + dev_warn(anv->dev, "ctrl state %d is not RESETTING\n", state); 993 992 ret = -ENODEV; 994 993 goto out; 995 994 }
+9 -10
drivers/nvme/host/auth.c
··· 48 48 49 49 static struct workqueue_struct *nvme_auth_wq; 50 50 51 - #define nvme_auth_flags_from_qid(qid) \ 52 - (qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED 53 - #define nvme_auth_queue_from_qid(ctrl, qid) \ 54 - (qid == 0) ? (ctrl)->fabrics_q : (ctrl)->connect_q 55 - 56 51 static inline int ctrl_max_dhchaps(struct nvme_ctrl *ctrl) 57 52 { 58 53 return ctrl->opts->nr_io_queues + ctrl->opts->nr_write_queues + ··· 58 63 void *data, size_t data_len, bool auth_send) 59 64 { 60 65 struct nvme_command cmd = {}; 61 - blk_mq_req_flags_t flags = nvme_auth_flags_from_qid(qid); 62 - struct request_queue *q = nvme_auth_queue_from_qid(ctrl, qid); 66 + nvme_submit_flags_t flags = NVME_SUBMIT_RETRY; 67 + struct request_queue *q = ctrl->fabrics_q; 63 68 int ret; 69 + 70 + if (qid != 0) { 71 + flags |= NVME_SUBMIT_NOWAIT | NVME_SUBMIT_RESERVED; 72 + q = ctrl->connect_q; 73 + } 64 74 65 75 cmd.auth_common.opcode = nvme_fabrics_command; 66 76 cmd.auth_common.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER; ··· 80 80 } 81 81 82 82 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, data_len, 83 - qid == 0 ? NVME_QID_ANY : qid, 84 - 0, flags); 83 + qid == 0 ? NVME_QID_ANY : qid, flags); 85 84 if (ret > 0) 86 85 dev_warn(ctrl->device, 87 86 "qid %d auth_send failed with status %d\n", qid, ret); ··· 896 897 * If the ctrl is no connected, bail as reconnect will handle 897 898 * authentication. 898 899 */ 899 - if (ctrl->state != NVME_CTRL_LIVE) 900 + if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) 900 901 return; 901 902 902 903 /* Authenticate admin queue first */
+5 -5
drivers/nvme/host/constants.c
··· 171 171 [NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command", 172 172 }; 173 173 174 - const unsigned char *nvme_get_error_status_str(u16 status) 174 + const char *nvme_get_error_status_str(u16 status) 175 175 { 176 176 status &= 0x7ff; 177 177 if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status]) 178 - return nvme_statuses[status & 0x7ff]; 178 + return nvme_statuses[status]; 179 179 return "Unknown"; 180 180 } 181 181 182 - const unsigned char *nvme_get_opcode_str(u8 opcode) 182 + const char *nvme_get_opcode_str(u8 opcode) 183 183 { 184 184 if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode]) 185 185 return nvme_ops[opcode]; ··· 187 187 } 188 188 EXPORT_SYMBOL_GPL(nvme_get_opcode_str); 189 189 190 - const unsigned char *nvme_get_admin_opcode_str(u8 opcode) 190 + const char *nvme_get_admin_opcode_str(u8 opcode) 191 191 { 192 192 if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode]) 193 193 return nvme_admin_ops[opcode]; ··· 195 195 } 196 196 EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str); 197 197 198 - const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) { 198 + const char *nvme_get_fabrics_opcode_str(u8 opcode) { 199 199 if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode]) 200 200 return nvme_fabrics_ops[opcode]; 201 201 return "Unknown";
+70 -15
drivers/nvme/host/core.c
··· 338 338 nr->status & NVME_SC_DNR ? "DNR " : ""); 339 339 } 340 340 341 + static void nvme_log_err_passthru(struct request *req) 342 + { 343 + struct nvme_ns *ns = req->q->queuedata; 344 + struct nvme_request *nr = nvme_req(req); 345 + 346 + pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s" 347 + "cdw10=0x%x cdw11=0x%x cdw12=0x%x cdw13=0x%x cdw14=0x%x cdw15=0x%x\n", 348 + ns ? ns->disk->disk_name : dev_name(nr->ctrl->device), 349 + ns ? nvme_get_opcode_str(nr->cmd->common.opcode) : 350 + nvme_get_admin_opcode_str(nr->cmd->common.opcode), 351 + nr->cmd->common.opcode, 352 + nvme_get_error_status_str(nr->status), 353 + nr->status >> 8 & 7, /* Status Code Type */ 354 + nr->status & 0xff, /* Status Code */ 355 + nr->status & NVME_SC_MORE ? "MORE " : "", 356 + nr->status & NVME_SC_DNR ? "DNR " : "", 357 + nr->cmd->common.cdw10, 358 + nr->cmd->common.cdw11, 359 + nr->cmd->common.cdw12, 360 + nr->cmd->common.cdw13, 361 + nr->cmd->common.cdw14, 362 + nr->cmd->common.cdw14); 363 + } 364 + 341 365 enum nvme_disposition { 342 366 COMPLETE, 343 367 RETRY, ··· 409 385 { 410 386 blk_status_t status = nvme_error_status(nvme_req(req)->status); 411 387 412 - if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) 413 - nvme_log_error(req); 388 + if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) { 389 + if (blk_rq_is_passthrough(req)) 390 + nvme_log_err_passthru(req); 391 + else 392 + nvme_log_error(req); 393 + } 414 394 nvme_end_req_zoned(req); 415 395 nvme_trace_bio_complete(req); 416 396 if (req->cmd_flags & REQ_NVME_MPATH) ··· 707 679 /* initialize a passthrough request */ 708 680 void nvme_init_request(struct request *req, struct nvme_command *cmd) 709 681 { 710 - if (req->q->queuedata) 682 + struct nvme_request *nr = nvme_req(req); 683 + bool logging_enabled; 684 + 685 + if (req->q->queuedata) { 686 + struct nvme_ns *ns = req->q->disk->private_data; 687 + 688 + logging_enabled = ns->passthru_err_log_enabled; 711 689 req->timeout = NVME_IO_TIMEOUT; 712 - else /* no queuedata implies admin queue */ 690 + } else { /* no queuedata implies admin queue */ 691 + logging_enabled = nr->ctrl->passthru_err_log_enabled; 713 692 req->timeout = NVME_ADMIN_TIMEOUT; 693 + } 694 + 695 + if (!logging_enabled) 696 + req->rq_flags |= RQF_QUIET; 714 697 715 698 /* passthru commands should let the driver set the SGL flags */ 716 699 cmd->common.flags &= ~NVME_CMD_SGL_ALL; ··· 730 691 if (req->mq_hctx->type == HCTX_TYPE_POLL) 731 692 req->cmd_flags |= REQ_POLLED; 732 693 nvme_clear_nvme_request(req); 733 - req->rq_flags |= RQF_QUIET; 734 - memcpy(nvme_req(req)->cmd, cmd, sizeof(*cmd)); 694 + memcpy(nr->cmd, cmd, sizeof(*cmd)); 735 695 } 736 696 EXPORT_SYMBOL_GPL(nvme_init_request); 737 697 ··· 759 721 EXPORT_SYMBOL_GPL(nvme_fail_nonready_command); 760 722 761 723 bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, 762 - bool queue_live) 724 + bool queue_live, enum nvme_ctrl_state state) 763 725 { 764 726 struct nvme_request *req = nvme_req(rq); 765 727 ··· 780 742 * command, which is require to set the queue live in the 781 743 * appropinquate states. 782 744 */ 783 - switch (nvme_ctrl_state(ctrl)) { 745 + switch (state) { 784 746 case NVME_CTRL_CONNECTING: 785 747 if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) && 786 748 (req->cmd->fabrics.fctype == nvme_fabrics_type_connect || ··· 1089 1051 */ 1090 1052 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, 1091 1053 union nvme_result *result, void *buffer, unsigned bufflen, 1092 - int qid, int at_head, blk_mq_req_flags_t flags) 1054 + int qid, nvme_submit_flags_t flags) 1093 1055 { 1094 1056 struct request *req; 1095 1057 int ret; 1058 + blk_mq_req_flags_t blk_flags = 0; 1096 1059 1060 + if (flags & NVME_SUBMIT_NOWAIT) 1061 + blk_flags |= BLK_MQ_REQ_NOWAIT; 1062 + if (flags & NVME_SUBMIT_RESERVED) 1063 + blk_flags |= BLK_MQ_REQ_RESERVED; 1097 1064 if (qid == NVME_QID_ANY) 1098 - req = blk_mq_alloc_request(q, nvme_req_op(cmd), flags); 1065 + req = blk_mq_alloc_request(q, nvme_req_op(cmd), blk_flags); 1099 1066 else 1100 - req = blk_mq_alloc_request_hctx(q, nvme_req_op(cmd), flags, 1067 + req = blk_mq_alloc_request_hctx(q, nvme_req_op(cmd), blk_flags, 1101 1068 qid - 1); 1102 1069 1103 1070 if (IS_ERR(req)) 1104 1071 return PTR_ERR(req); 1105 1072 nvme_init_request(req, cmd); 1073 + if (flags & NVME_SUBMIT_RETRY) 1074 + req->cmd_flags &= ~REQ_FAILFAST_DRIVER; 1106 1075 1107 1076 if (buffer && bufflen) { 1108 1077 ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL); ··· 1117 1072 goto out; 1118 1073 } 1119 1074 1120 - ret = nvme_execute_rq(req, at_head); 1075 + ret = nvme_execute_rq(req, flags & NVME_SUBMIT_AT_HEAD); 1121 1076 if (result && ret >= 0) 1122 1077 *result = nvme_req(req)->result; 1123 1078 out: ··· 1130 1085 void *buffer, unsigned bufflen) 1131 1086 { 1132 1087 return __nvme_submit_sync_cmd(q, cmd, NULL, buffer, bufflen, 1133 - NVME_QID_ANY, 0, 0); 1088 + NVME_QID_ANY, 0); 1134 1089 } 1135 1090 EXPORT_SYMBOL_GPL(nvme_submit_sync_cmd); 1136 1091 ··· 1605 1560 c.features.dword11 = cpu_to_le32(dword11); 1606 1561 1607 1562 ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &res, 1608 - buffer, buflen, NVME_QID_ANY, 0, 0); 1563 + buffer, buflen, NVME_QID_ANY, 0); 1609 1564 if (ret >= 0 && result) 1610 1565 *result = le32_to_cpu(res.u32); 1611 1566 return ret; ··· 2217 2172 cmd.common.cdw11 = cpu_to_le32(len); 2218 2173 2219 2174 return __nvme_submit_sync_cmd(ctrl->admin_q, &cmd, NULL, buffer, len, 2220 - NVME_QID_ANY, 1, 0); 2175 + NVME_QID_ANY, NVME_SUBMIT_AT_HEAD); 2221 2176 } 2222 2177 2223 2178 static void nvme_configure_opal(struct nvme_ctrl *ctrl, bool was_suspended) ··· 3696 3651 3697 3652 ns->disk = disk; 3698 3653 ns->queue = disk->queue; 3654 + ns->passthru_err_log_enabled = false; 3699 3655 3700 3656 if (ctrl->opts && ctrl->opts->data_digest) 3701 3657 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue); ··· 3759 3713 3760 3714 nvme_mpath_add_disk(ns, info->anagrpid); 3761 3715 nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name); 3716 + 3717 + /* 3718 + * Set ns->disk->device->driver_data to ns so we can access 3719 + * ns->logging_enabled in nvme_passthru_err_log_enabled_store() and 3720 + * nvme_passthru_err_log_enabled_show(). 3721 + */ 3722 + dev_set_drvdata(disk_to_dev(ns->disk), ns); 3762 3723 3763 3724 return; 3764 3725 ··· 4567 4514 int ret; 4568 4515 4569 4516 WRITE_ONCE(ctrl->state, NVME_CTRL_NEW); 4517 + ctrl->passthru_err_log_enabled = false; 4570 4518 clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags); 4571 4519 spin_lock_init(&ctrl->lock); 4572 4520 mutex_init(&ctrl->scan_lock); ··· 4905 4851 4906 4852 MODULE_LICENSE("GPL"); 4907 4853 MODULE_VERSION("1.0"); 4854 + MODULE_DESCRIPTION("NVMe host core framework"); 4908 4855 module_init(nvme_core_init); 4909 4856 module_exit(nvme_core_exit);
+12 -7
drivers/nvme/host/fabrics.c
··· 180 180 cmd.prop_get.offset = cpu_to_le32(off); 181 181 182 182 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0, 183 - NVME_QID_ANY, 0, 0); 183 + NVME_QID_ANY, 0); 184 184 185 185 if (ret >= 0) 186 186 *val = le64_to_cpu(res.u64); ··· 226 226 cmd.prop_get.offset = cpu_to_le32(off); 227 227 228 228 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0, 229 - NVME_QID_ANY, 0, 0); 229 + NVME_QID_ANY, 0); 230 230 231 231 if (ret >= 0) 232 232 *val = le64_to_cpu(res.u64); ··· 271 271 cmd.prop_set.value = cpu_to_le64(val); 272 272 273 273 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, NULL, NULL, 0, 274 - NVME_QID_ANY, 0, 0); 274 + NVME_QID_ANY, 0); 275 275 if (unlikely(ret)) 276 276 dev_err(ctrl->device, 277 277 "Property Set error: %d, offset %#x\n", ··· 450 450 return -ENOMEM; 451 451 452 452 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, 453 - data, sizeof(*data), NVME_QID_ANY, 1, 454 - BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT); 453 + data, sizeof(*data), NVME_QID_ANY, 454 + NVME_SUBMIT_AT_HEAD | 455 + NVME_SUBMIT_NOWAIT | 456 + NVME_SUBMIT_RESERVED); 455 457 if (ret) { 456 458 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32), 457 459 &cmd, data); ··· 527 525 return -ENOMEM; 528 526 529 527 ret = __nvme_submit_sync_cmd(ctrl->connect_q, &cmd, &res, 530 - data, sizeof(*data), qid, 1, 531 - BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT); 528 + data, sizeof(*data), qid, 529 + NVME_SUBMIT_AT_HEAD | 530 + NVME_SUBMIT_RESERVED | 531 + NVME_SUBMIT_NOWAIT); 532 532 if (ret) { 533 533 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32), 534 534 &cmd, data); ··· 1492 1488 } 1493 1489 1494 1490 MODULE_LICENSE("GPL v2"); 1491 + MODULE_DESCRIPTION("NVMe host fabrics library"); 1495 1492 1496 1493 module_init(nvmf_init); 1497 1494 module_exit(nvmf_exit);
+5 -3
drivers/nvme/host/fabrics.h
··· 185 185 nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl, 186 186 struct nvmf_ctrl_options *opts) 187 187 { 188 - if (ctrl->state == NVME_CTRL_DELETING || 189 - ctrl->state == NVME_CTRL_DELETING_NOIO || 190 - ctrl->state == NVME_CTRL_DEAD || 188 + enum nvme_ctrl_state state = nvme_ctrl_state(ctrl); 189 + 190 + if (state == NVME_CTRL_DELETING || 191 + state == NVME_CTRL_DELETING_NOIO || 192 + state == NVME_CTRL_DEAD || 191 193 strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) || 192 194 strcmp(opts->host->nqn, ctrl->opts->host->nqn) || 193 195 !uuid_equal(&opts->host->id, &ctrl->opts->host->id))
+14 -46
drivers/nvme/host/fc.c
··· 221 221 static DEFINE_IDA(nvme_fc_local_port_cnt); 222 222 static DEFINE_IDA(nvme_fc_ctrl_cnt); 223 223 224 - static struct workqueue_struct *nvme_fc_wq; 225 - 226 - static bool nvme_fc_waiting_to_unload; 227 - static DECLARE_COMPLETION(nvme_fc_unload_proceed); 228 - 229 224 /* 230 225 * These items are short-term. They will eventually be moved into 231 226 * a generic FC class. See comments in module init. ··· 250 255 /* remove from transport list */ 251 256 spin_lock_irqsave(&nvme_fc_lock, flags); 252 257 list_del(&lport->port_list); 253 - if (nvme_fc_waiting_to_unload && list_empty(&nvme_fc_lport_list)) 254 - complete(&nvme_fc_unload_proceed); 255 258 spin_unlock_irqrestore(&nvme_fc_lock, flags); 256 259 257 260 ida_free(&nvme_fc_local_port_cnt, lport->localport.port_num); ··· 2567 2574 { 2568 2575 struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq); 2569 2576 struct nvme_fc_ctrl *ctrl = op->ctrl; 2577 + u16 qnum = op->queue->qnum; 2570 2578 struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; 2571 2579 struct nvme_command *sqe = &cmdiu->sqe; 2572 2580 ··· 2576 2582 * will detect the aborted io and will fail the connection. 2577 2583 */ 2578 2584 dev_info(ctrl->ctrl.device, 2579 - "NVME-FC{%d.%d}: io timeout: opcode %d fctype %d w10/11: " 2585 + "NVME-FC{%d.%d}: io timeout: opcode %d fctype %d (%s) w10/11: " 2580 2586 "x%08x/x%08x\n", 2581 - ctrl->cnum, op->queue->qnum, sqe->common.opcode, 2582 - sqe->connect.fctype, sqe->common.cdw10, sqe->common.cdw11); 2587 + ctrl->cnum, qnum, sqe->common.opcode, sqe->fabrics.fctype, 2588 + nvme_fabrics_opcode_str(qnum, sqe), 2589 + sqe->common.cdw10, sqe->common.cdw11); 2583 2590 if (__nvme_fc_abort_op(ctrl, op)) 2584 2591 nvme_fc_error_recovery(ctrl, "io timeout abort failed"); 2585 2592 ··· 3570 3575 flush_delayed_work(&ctrl->connect_work); 3571 3576 3572 3577 dev_info(ctrl->ctrl.device, 3573 - "NVME-FC{%d}: new ctrl: NQN \"%s\"\n", 3574 - ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl)); 3578 + "NVME-FC{%d}: new ctrl: NQN \"%s\", hostnqn: %s\n", 3579 + ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl), opts->host->nqn); 3575 3580 3576 3581 return &ctrl->ctrl; 3577 3582 ··· 3889 3894 { 3890 3895 int ret; 3891 3896 3892 - nvme_fc_wq = alloc_workqueue("nvme_fc_wq", WQ_MEM_RECLAIM, 0); 3893 - if (!nvme_fc_wq) 3894 - return -ENOMEM; 3895 - 3896 3897 /* 3897 3898 * NOTE: 3898 3899 * It is expected that in the future the kernel will combine ··· 3906 3915 ret = class_register(&fc_class); 3907 3916 if (ret) { 3908 3917 pr_err("couldn't register class fc\n"); 3909 - goto out_destroy_wq; 3918 + return ret; 3910 3919 } 3911 3920 3912 3921 /* ··· 3930 3939 device_destroy(&fc_class, MKDEV(0, 0)); 3931 3940 out_destroy_class: 3932 3941 class_unregister(&fc_class); 3933 - out_destroy_wq: 3934 - destroy_workqueue(nvme_fc_wq); 3935 3942 3936 3943 return ret; 3937 3944 } ··· 3949 3960 spin_unlock(&rport->lock); 3950 3961 } 3951 3962 3952 - static void 3953 - nvme_fc_cleanup_for_unload(void) 3963 + static void __exit nvme_fc_exit_module(void) 3954 3964 { 3955 3965 struct nvme_fc_lport *lport; 3956 3966 struct nvme_fc_rport *rport; 3957 - 3958 - list_for_each_entry(lport, &nvme_fc_lport_list, port_list) { 3959 - list_for_each_entry(rport, &lport->endp_list, endp_list) { 3960 - nvme_fc_delete_controllers(rport); 3961 - } 3962 - } 3963 - } 3964 - 3965 - static void __exit nvme_fc_exit_module(void) 3966 - { 3967 3967 unsigned long flags; 3968 - bool need_cleanup = false; 3969 3968 3970 3969 spin_lock_irqsave(&nvme_fc_lock, flags); 3971 - nvme_fc_waiting_to_unload = true; 3972 - if (!list_empty(&nvme_fc_lport_list)) { 3973 - need_cleanup = true; 3974 - nvme_fc_cleanup_for_unload(); 3975 - } 3970 + list_for_each_entry(lport, &nvme_fc_lport_list, port_list) 3971 + list_for_each_entry(rport, &lport->endp_list, endp_list) 3972 + nvme_fc_delete_controllers(rport); 3976 3973 spin_unlock_irqrestore(&nvme_fc_lock, flags); 3977 - if (need_cleanup) { 3978 - pr_info("%s: waiting for ctlr deletes\n", __func__); 3979 - wait_for_completion(&nvme_fc_unload_proceed); 3980 - pr_info("%s: ctrl deletes complete\n", __func__); 3981 - } 3974 + flush_workqueue(nvme_delete_wq); 3982 3975 3983 3976 nvmf_unregister_transport(&nvme_fc_transport); 3984 3977 3985 - ida_destroy(&nvme_fc_local_port_cnt); 3986 - ida_destroy(&nvme_fc_ctrl_cnt); 3987 - 3988 3978 device_destroy(&fc_class, MKDEV(0, 0)); 3989 3979 class_unregister(&fc_class); 3990 - destroy_workqueue(nvme_fc_wq); 3991 3980 } 3992 3981 3993 3982 module_init(nvme_fc_init_module); 3994 3983 module_exit(nvme_fc_exit_module); 3995 3984 3985 + MODULE_DESCRIPTION("NVMe host FC transport driver"); 3996 3986 MODULE_LICENSE("GPL v2");
+8 -7
drivers/nvme/host/multipath.c
··· 156 156 if (!ns->head->disk) 157 157 continue; 158 158 kblockd_schedule_work(&ns->head->requeue_work); 159 - if (ctrl->state == NVME_CTRL_LIVE) 159 + if (nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE) 160 160 disk_uevent(ns->head->disk, KOBJ_CHANGE); 161 161 } 162 162 up_read(&ctrl->namespaces_rwsem); ··· 223 223 224 224 static bool nvme_path_is_disabled(struct nvme_ns *ns) 225 225 { 226 + enum nvme_ctrl_state state = nvme_ctrl_state(ns->ctrl); 227 + 226 228 /* 227 229 * We don't treat NVME_CTRL_DELETING as a disabled path as I/O should 228 230 * still be able to complete assuming that the controller is connected. 229 231 * Otherwise it will fail immediately and return to the requeue list. 230 232 */ 231 - if (ns->ctrl->state != NVME_CTRL_LIVE && 232 - ns->ctrl->state != NVME_CTRL_DELETING) 233 + if (state != NVME_CTRL_LIVE && state != NVME_CTRL_DELETING) 233 234 return true; 234 235 if (test_bit(NVME_NS_ANA_PENDING, &ns->flags) || 235 236 !test_bit(NVME_NS_READY, &ns->flags)) ··· 332 331 333 332 static inline bool nvme_path_is_optimized(struct nvme_ns *ns) 334 333 { 335 - return ns->ctrl->state == NVME_CTRL_LIVE && 334 + return nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE && 336 335 ns->ana_state == NVME_ANA_OPTIMIZED; 337 336 } 338 337 ··· 359 358 list_for_each_entry_rcu(ns, &head->list, siblings) { 360 359 if (test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ns->ctrl->flags)) 361 360 continue; 362 - switch (ns->ctrl->state) { 361 + switch (nvme_ctrl_state(ns->ctrl)) { 363 362 case NVME_CTRL_LIVE: 364 363 case NVME_CTRL_RESETTING: 365 364 case NVME_CTRL_CONNECTING: ··· 668 667 * controller is ready. 669 668 */ 670 669 if (nvme_state_is_live(ns->ana_state) && 671 - ns->ctrl->state == NVME_CTRL_LIVE) 670 + nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE) 672 671 nvme_mpath_set_live(ns); 673 672 } 674 673 ··· 749 748 { 750 749 struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, ana_work); 751 750 752 - if (ctrl->state != NVME_CTRL_LIVE) 751 + if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) 753 752 return; 754 753 755 754 nvme_read_ana_log(ctrl);
+43 -19
drivers/nvme/host/nvme.h
··· 263 263 struct nvme_ctrl { 264 264 bool comp_seen; 265 265 bool identified; 266 + bool passthru_err_log_enabled; 266 267 enum nvme_ctrl_state state; 267 268 spinlock_t lock; 268 269 struct mutex scan_lock; ··· 523 522 struct device cdev_device; 524 523 525 524 struct nvme_fault_inject fault_inject; 526 - 525 + bool passthru_err_log_enabled; 527 526 }; 528 527 529 528 /* NVMe ns supports metadata actions by the controller (generate/strip) */ ··· 806 805 blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl, 807 806 struct request *req); 808 807 bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, 809 - bool queue_live); 808 + bool queue_live, enum nvme_ctrl_state state); 810 809 811 810 static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, 812 811 bool queue_live) 813 812 { 814 - if (likely(ctrl->state == NVME_CTRL_LIVE)) 813 + enum nvme_ctrl_state state = nvme_ctrl_state(ctrl); 814 + 815 + if (likely(state == NVME_CTRL_LIVE)) 815 816 return true; 816 - if (ctrl->ops->flags & NVME_F_FABRICS && 817 - ctrl->state == NVME_CTRL_DELETING) 817 + if (ctrl->ops->flags & NVME_F_FABRICS && state == NVME_CTRL_DELETING) 818 818 return queue_live; 819 - return __nvme_check_ready(ctrl, rq, queue_live); 819 + return __nvme_check_ready(ctrl, rq, queue_live, state); 820 820 } 821 821 822 822 /* ··· 838 836 (ctrl->ctratt & NVME_CTRL_CTRATT_NVM_SETS); 839 837 } 840 838 839 + /* 840 + * Flags for __nvme_submit_sync_cmd() 841 + */ 842 + typedef __u32 __bitwise nvme_submit_flags_t; 843 + 844 + enum { 845 + /* Insert request at the head of the queue */ 846 + NVME_SUBMIT_AT_HEAD = (__force nvme_submit_flags_t)(1 << 0), 847 + /* Set BLK_MQ_REQ_NOWAIT when allocating request */ 848 + NVME_SUBMIT_NOWAIT = (__force nvme_submit_flags_t)(1 << 1), 849 + /* Set BLK_MQ_REQ_RESERVED when allocating request */ 850 + NVME_SUBMIT_RESERVED = (__force nvme_submit_flags_t)(1 << 2), 851 + /* Retry command when NVME_SC_DNR is not set in the result */ 852 + NVME_SUBMIT_RETRY = (__force nvme_submit_flags_t)(1 << 3), 853 + }; 854 + 841 855 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, 842 856 void *buf, unsigned bufflen); 843 857 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, 844 858 union nvme_result *result, void *buffer, unsigned bufflen, 845 - int qid, int at_head, 846 - blk_mq_req_flags_t flags); 859 + int qid, nvme_submit_flags_t flags); 847 860 int nvme_set_features(struct nvme_ctrl *dev, unsigned int fid, 848 861 unsigned int dword11, void *buffer, size_t buflen, 849 862 u32 *result); ··· 1141 1124 } 1142 1125 1143 1126 #ifdef CONFIG_NVME_VERBOSE_ERRORS 1144 - const unsigned char *nvme_get_error_status_str(u16 status); 1145 - const unsigned char *nvme_get_opcode_str(u8 opcode); 1146 - const unsigned char *nvme_get_admin_opcode_str(u8 opcode); 1147 - const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode); 1127 + const char *nvme_get_error_status_str(u16 status); 1128 + const char *nvme_get_opcode_str(u8 opcode); 1129 + const char *nvme_get_admin_opcode_str(u8 opcode); 1130 + const char *nvme_get_fabrics_opcode_str(u8 opcode); 1148 1131 #else /* CONFIG_NVME_VERBOSE_ERRORS */ 1149 - static inline const unsigned char *nvme_get_error_status_str(u16 status) 1132 + static inline const char *nvme_get_error_status_str(u16 status) 1150 1133 { 1151 1134 return "I/O Error"; 1152 1135 } 1153 - static inline const unsigned char *nvme_get_opcode_str(u8 opcode) 1136 + static inline const char *nvme_get_opcode_str(u8 opcode) 1154 1137 { 1155 1138 return "I/O Cmd"; 1156 1139 } 1157 - static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode) 1140 + static inline const char *nvme_get_admin_opcode_str(u8 opcode) 1158 1141 { 1159 1142 return "Admin Cmd"; 1160 1143 } 1161 1144 1162 - static inline const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) 1145 + static inline const char *nvme_get_fabrics_opcode_str(u8 opcode) 1163 1146 { 1164 1147 return "Fabrics Cmd"; 1165 1148 } 1166 1149 #endif /* CONFIG_NVME_VERBOSE_ERRORS */ 1167 1150 1168 - static inline const unsigned char *nvme_opcode_str(int qid, u8 opcode, u8 fctype) 1151 + static inline const char *nvme_opcode_str(int qid, u8 opcode) 1169 1152 { 1170 - if (opcode == nvme_fabrics_command) 1171 - return nvme_get_fabrics_opcode_str(fctype); 1172 1153 return qid ? nvme_get_opcode_str(opcode) : 1173 1154 nvme_get_admin_opcode_str(opcode); 1155 + } 1156 + 1157 + static inline const char *nvme_fabrics_opcode_str( 1158 + int qid, const struct nvme_command *cmd) 1159 + { 1160 + if (nvme_is_fabrics(cmd)) 1161 + return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype); 1162 + 1163 + return nvme_opcode_str(qid, cmd->common.opcode); 1174 1164 } 1175 1165 #endif /* _NVME_H */
+2 -1
drivers/nvme/host/pci.c
··· 1349 1349 dev_warn(dev->ctrl.device, 1350 1350 "I/O tag %d (%04x) opcode %#x (%s) QID %d timeout, reset controller\n", 1351 1351 req->tag, nvme_cid(req), opcode, 1352 - nvme_opcode_str(nvmeq->qid, opcode, 0), nvmeq->qid); 1352 + nvme_opcode_str(nvmeq->qid, opcode), nvmeq->qid); 1353 1353 nvme_req(req)->flags |= NVME_REQ_CANCELLED; 1354 1354 goto disable; 1355 1355 } ··· 3543 3543 MODULE_AUTHOR("Matthew Wilcox <willy@linux.intel.com>"); 3544 3544 MODULE_LICENSE("GPL"); 3545 3545 MODULE_VERSION("1.0"); 3546 + MODULE_DESCRIPTION("NVMe host PCIe transport driver"); 3546 3547 module_init(nvme_init); 3547 3548 module_exit(nvme_exit);
+14 -9
drivers/nvme/host/rdma.c
··· 1410 1410 struct nvme_ns *ns = rq->q->queuedata; 1411 1411 struct bio *bio = rq->bio; 1412 1412 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl; 1413 + struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); 1414 + u32 xfer_len; 1413 1415 int nr; 1414 1416 1415 1417 req->mr = ib_mr_pool_get(queue->qp, &queue->qp->sig_mrs); ··· 1424 1422 if (unlikely(nr)) 1425 1423 goto mr_put; 1426 1424 1427 - nvme_rdma_set_sig_attrs(blk_get_integrity(bio->bi_bdev->bd_disk), c, 1428 - req->mr->sig_attrs, ns->head->pi_type); 1425 + nvme_rdma_set_sig_attrs(bi, c, req->mr->sig_attrs, ns->head->pi_type); 1429 1426 nvme_rdma_set_prot_checks(c, &req->mr->sig_attrs->check_mask); 1430 1427 1431 1428 ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey)); ··· 1442 1441 IB_ACCESS_REMOTE_WRITE; 1443 1442 1444 1443 sg->addr = cpu_to_le64(req->mr->iova); 1445 - put_unaligned_le24(req->mr->length, sg->length); 1444 + xfer_len = req->mr->length; 1445 + /* Check if PI is added by the HW */ 1446 + if (!pi_count) 1447 + xfer_len += (xfer_len >> bi->interval_exp) * ns->head->pi_size; 1448 + put_unaligned_le24(xfer_len, sg->length); 1446 1449 put_unaligned_le32(req->mr->rkey, sg->key); 1447 1450 sg->type = NVME_KEY_SGL_FMT_DATA_DESC << 4; 1448 1451 ··· 1951 1946 struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); 1952 1947 struct nvme_rdma_queue *queue = req->queue; 1953 1948 struct nvme_rdma_ctrl *ctrl = queue->ctrl; 1954 - u8 opcode = req->req.cmd->common.opcode; 1955 - u8 fctype = req->req.cmd->fabrics.fctype; 1949 + struct nvme_command *cmd = req->req.cmd; 1956 1950 int qid = nvme_rdma_queue_idx(queue); 1957 1951 1958 1952 dev_warn(ctrl->ctrl.device, 1959 1953 "I/O tag %d (%04x) opcode %#x (%s) QID %d timeout\n", 1960 - rq->tag, nvme_cid(rq), opcode, 1961 - nvme_opcode_str(qid, opcode, fctype), qid); 1954 + rq->tag, nvme_cid(rq), cmd->common.opcode, 1955 + nvme_fabrics_opcode_str(qid, cmd), qid); 1962 1956 1963 1957 if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_LIVE) { 1964 1958 /* ··· 2300 2296 if (ret) 2301 2297 goto out_uninit_ctrl; 2302 2298 2303 - dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs\n", 2304 - nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr); 2299 + dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs, hostnqn: %s\n", 2300 + nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr, opts->host->nqn); 2305 2301 2306 2302 mutex_lock(&nvme_rdma_ctrl_mutex); 2307 2303 list_add_tail(&ctrl->list, &nvme_rdma_ctrl_list); ··· 2404 2400 module_init(nvme_rdma_init_module); 2405 2401 module_exit(nvme_rdma_cleanup_module); 2406 2402 2403 + MODULE_DESCRIPTION("NVMe host RDMA transport driver"); 2407 2404 MODULE_LICENSE("GPL v2");
+61 -3
drivers/nvme/host/sysfs.c
··· 35 35 } 36 36 static DEVICE_ATTR(rescan_controller, S_IWUSR, NULL, nvme_sysfs_rescan); 37 37 38 + static ssize_t nvme_adm_passthru_err_log_enabled_show(struct device *dev, 39 + struct device_attribute *attr, char *buf) 40 + { 41 + struct nvme_ctrl *ctrl = dev_get_drvdata(dev); 42 + 43 + return sysfs_emit(buf, 44 + ctrl->passthru_err_log_enabled ? "on\n" : "off\n"); 45 + } 46 + 47 + static ssize_t nvme_adm_passthru_err_log_enabled_store(struct device *dev, 48 + struct device_attribute *attr, const char *buf, size_t count) 49 + { 50 + struct nvme_ctrl *ctrl = dev_get_drvdata(dev); 51 + int err; 52 + bool passthru_err_log_enabled; 53 + 54 + err = kstrtobool(buf, &passthru_err_log_enabled); 55 + if (err) 56 + return -EINVAL; 57 + 58 + ctrl->passthru_err_log_enabled = passthru_err_log_enabled; 59 + 60 + return count; 61 + } 62 + 63 + static ssize_t nvme_io_passthru_err_log_enabled_show(struct device *dev, 64 + struct device_attribute *attr, char *buf) 65 + { 66 + struct nvme_ns *n = dev_get_drvdata(dev); 67 + 68 + return sysfs_emit(buf, n->passthru_err_log_enabled ? "on\n" : "off\n"); 69 + } 70 + 71 + static ssize_t nvme_io_passthru_err_log_enabled_store(struct device *dev, 72 + struct device_attribute *attr, const char *buf, size_t count) 73 + { 74 + struct nvme_ns *ns = dev_get_drvdata(dev); 75 + int err; 76 + bool passthru_err_log_enabled; 77 + 78 + err = kstrtobool(buf, &passthru_err_log_enabled); 79 + if (err) 80 + return -EINVAL; 81 + ns->passthru_err_log_enabled = passthru_err_log_enabled; 82 + 83 + return count; 84 + } 85 + 86 + static struct device_attribute dev_attr_adm_passthru_err_log_enabled = \ 87 + __ATTR(passthru_err_log_enabled, S_IRUGO | S_IWUSR, \ 88 + nvme_adm_passthru_err_log_enabled_show, nvme_adm_passthru_err_log_enabled_store); 89 + 90 + static struct device_attribute dev_attr_io_passthru_err_log_enabled = \ 91 + __ATTR(passthru_err_log_enabled, S_IRUGO | S_IWUSR, \ 92 + nvme_io_passthru_err_log_enabled_show, nvme_io_passthru_err_log_enabled_store); 93 + 38 94 static inline struct nvme_ns_head *dev_to_ns_head(struct device *dev) 39 95 { 40 96 struct gendisk *disk = dev_to_disk(dev); ··· 264 208 &dev_attr_ana_grpid.attr, 265 209 &dev_attr_ana_state.attr, 266 210 #endif 211 + &dev_attr_io_passthru_err_log_enabled.attr, 267 212 NULL, 268 213 }; 269 214 ··· 368 311 char *buf) 369 312 { 370 313 struct nvme_ctrl *ctrl = dev_get_drvdata(dev); 314 + unsigned state = (unsigned)nvme_ctrl_state(ctrl); 371 315 static const char *const state_name[] = { 372 316 [NVME_CTRL_NEW] = "new", 373 317 [NVME_CTRL_LIVE] = "live", ··· 379 321 [NVME_CTRL_DEAD] = "dead", 380 322 }; 381 323 382 - if ((unsigned)ctrl->state < ARRAY_SIZE(state_name) && 383 - state_name[ctrl->state]) 384 - return sysfs_emit(buf, "%s\n", state_name[ctrl->state]); 324 + if (state < ARRAY_SIZE(state_name) && state_name[state]) 325 + return sysfs_emit(buf, "%s\n", state_name[state]); 385 326 386 327 return sysfs_emit(buf, "unknown state\n"); 387 328 } ··· 712 655 #ifdef CONFIG_NVME_TCP_TLS 713 656 &dev_attr_tls_key.attr, 714 657 #endif 658 + &dev_attr_adm_passthru_err_log_enabled.attr, 715 659 NULL 716 660 }; 717 661
+6 -5
drivers/nvme/host/tcp.c
··· 2428 2428 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); 2429 2429 struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; 2430 2430 struct nvme_tcp_cmd_pdu *pdu = nvme_tcp_req_cmd_pdu(req); 2431 - u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype; 2431 + struct nvme_command *cmd = &pdu->cmd; 2432 2432 int qid = nvme_tcp_queue_id(req->queue); 2433 2433 2434 2434 dev_warn(ctrl->device, 2435 2435 "I/O tag %d (%04x) type %d opcode %#x (%s) QID %d timeout\n", 2436 - rq->tag, nvme_cid(rq), pdu->hdr.type, opc, 2437 - nvme_opcode_str(qid, opc, fctype), qid); 2436 + rq->tag, nvme_cid(rq), pdu->hdr.type, cmd->common.opcode, 2437 + nvme_fabrics_opcode_str(qid, cmd), qid); 2438 2438 2439 2439 if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) { 2440 2440 /* ··· 2753 2753 if (ret) 2754 2754 goto out_uninit_ctrl; 2755 2755 2756 - dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISp\n", 2757 - nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr); 2756 + dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISp, hostnqn: %s\n", 2757 + nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr, opts->host->nqn); 2758 2758 2759 2759 mutex_lock(&nvme_tcp_ctrl_mutex); 2760 2760 list_add_tail(&ctrl->list, &nvme_tcp_ctrl_list); ··· 2826 2826 module_init(nvme_tcp_init_module); 2827 2827 module_exit(nvme_tcp_cleanup_module); 2828 2828 2829 + MODULE_DESCRIPTION("NVMe host TCP transport driver"); 2829 2830 MODULE_LICENSE("GPL v2");
+3 -2
drivers/nvme/target/core.c
··· 248 248 nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid)); 249 249 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_NS_ATTR)) 250 250 continue; 251 - nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 251 + nvmet_add_async_event(ctrl, NVME_AER_NOTICE, 252 252 NVME_AER_NOTICE_NS_CHANGED, 253 253 NVME_LOG_CHANGED_NS); 254 254 } ··· 265 265 continue; 266 266 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_ANA_CHANGE)) 267 267 continue; 268 - nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 268 + nvmet_add_async_event(ctrl, NVME_AER_NOTICE, 269 269 NVME_AER_NOTICE_ANA, NVME_LOG_ANA); 270 270 } 271 271 mutex_unlock(&subsys->lock); ··· 1705 1705 module_init(nvmet_init); 1706 1706 module_exit(nvmet_exit); 1707 1707 1708 + MODULE_DESCRIPTION("NVMe target core framework"); 1708 1709 MODULE_LICENSE("GPL v2");
+1 -1
drivers/nvme/target/discovery.c
··· 21 21 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_DISC_CHANGE)) 22 22 return; 23 23 24 - nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 24 + nvmet_add_async_event(ctrl, NVME_AER_NOTICE, 25 25 NVME_AER_NOTICE_DISC_CHANGED, NVME_LOG_DISC); 26 26 } 27 27
+103 -83
drivers/nvme/target/fc.c
··· 111 111 struct nvmet_fc_port_entry *pe; 112 112 struct kref ref; 113 113 u32 max_sg_cnt; 114 + 115 + struct work_struct put_work; 114 116 }; 115 117 116 118 struct nvmet_fc_port_entry { ··· 147 145 struct list_head avail_defer_list; 148 146 struct workqueue_struct *work_q; 149 147 struct kref ref; 150 - struct rcu_head rcu; 151 148 /* array of fcp_iods */ 152 149 struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize); 153 150 } __aligned(sizeof(unsigned long long)); ··· 167 166 struct nvmet_fc_hostport *hostport; 168 167 struct nvmet_fc_ls_iod *rcv_disconn; 169 168 struct list_head a_list; 170 - struct nvmet_fc_tgt_queue __rcu *queues[NVMET_NR_QUEUES + 1]; 169 + struct nvmet_fc_tgt_queue *queues[NVMET_NR_QUEUES + 1]; 171 170 struct kref ref; 172 171 struct work_struct del_work; 173 - struct rcu_head rcu; 174 172 }; 175 173 176 174 ··· 249 249 static void nvmet_fc_tgt_q_put(struct nvmet_fc_tgt_queue *queue); 250 250 static int nvmet_fc_tgt_q_get(struct nvmet_fc_tgt_queue *queue); 251 251 static void nvmet_fc_tgtport_put(struct nvmet_fc_tgtport *tgtport); 252 + static void nvmet_fc_put_tgtport_work(struct work_struct *work) 253 + { 254 + struct nvmet_fc_tgtport *tgtport = 255 + container_of(work, struct nvmet_fc_tgtport, put_work); 256 + 257 + nvmet_fc_tgtport_put(tgtport); 258 + } 252 259 static int nvmet_fc_tgtport_get(struct nvmet_fc_tgtport *tgtport); 253 260 static void nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, 254 261 struct nvmet_fc_fcp_iod *fod); ··· 367 360 368 361 if (!lsop->req_queued) { 369 362 spin_unlock_irqrestore(&tgtport->lock, flags); 370 - return; 363 + goto out_putwork; 371 364 } 372 365 373 366 list_del(&lsop->lsreq_list); ··· 380 373 (lsreq->rqstlen + lsreq->rsplen), 381 374 DMA_BIDIRECTIONAL); 382 375 383 - nvmet_fc_tgtport_put(tgtport); 376 + out_putwork: 377 + queue_work(nvmet_wq, &tgtport->put_work); 384 378 } 385 379 386 380 static int ··· 497 489 * message is normal. Otherwise, send unless the hostport has 498 490 * already been invalidated by the lldd. 499 491 */ 500 - if (!tgtport->ops->ls_req || !assoc->hostport || 501 - assoc->hostport->invalid) 492 + if (!tgtport->ops->ls_req || assoc->hostport->invalid) 502 493 return; 503 494 504 495 lsop = kzalloc((sizeof(*lsop) + ··· 809 802 if (!queue) 810 803 return NULL; 811 804 812 - if (!nvmet_fc_tgt_a_get(assoc)) 813 - goto out_free_queue; 814 - 815 805 queue->work_q = alloc_workqueue("ntfc%d.%d.%d", 0, 0, 816 806 assoc->tgtport->fc_target_port.port_num, 817 807 assoc->a_id, qid); 818 808 if (!queue->work_q) 819 - goto out_a_put; 809 + goto out_free_queue; 820 810 821 811 queue->qid = qid; 822 812 queue->sqsize = sqsize; ··· 835 831 goto out_fail_iodlist; 836 832 837 833 WARN_ON(assoc->queues[qid]); 838 - rcu_assign_pointer(assoc->queues[qid], queue); 834 + assoc->queues[qid] = queue; 839 835 840 836 return queue; 841 837 842 838 out_fail_iodlist: 843 839 nvmet_fc_destroy_fcp_iodlist(assoc->tgtport, queue); 844 840 destroy_workqueue(queue->work_q); 845 - out_a_put: 846 - nvmet_fc_tgt_a_put(assoc); 847 841 out_free_queue: 848 842 kfree(queue); 849 843 return NULL; ··· 854 852 struct nvmet_fc_tgt_queue *queue = 855 853 container_of(ref, struct nvmet_fc_tgt_queue, ref); 856 854 857 - rcu_assign_pointer(queue->assoc->queues[queue->qid], NULL); 858 - 859 855 nvmet_fc_destroy_fcp_iodlist(queue->assoc->tgtport, queue); 860 - 861 - nvmet_fc_tgt_a_put(queue->assoc); 862 856 863 857 destroy_workqueue(queue->work_q); 864 858 865 - kfree_rcu(queue, rcu); 859 + kfree(queue); 866 860 } 867 861 868 862 static void ··· 967 969 rcu_read_lock(); 968 970 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { 969 971 if (association_id == assoc->association_id) { 970 - queue = rcu_dereference(assoc->queues[qid]); 972 + queue = assoc->queues[qid]; 971 973 if (queue && 972 974 (!atomic_read(&queue->connected) || 973 975 !nvmet_fc_tgt_q_get(queue))) ··· 1076 1078 /* new allocation not needed */ 1077 1079 kfree(newhost); 1078 1080 newhost = match; 1079 - /* no new allocation - release reference */ 1080 - nvmet_fc_tgtport_put(tgtport); 1081 1081 } else { 1082 1082 newhost->tgtport = tgtport; 1083 1083 newhost->hosthandle = hosthandle; ··· 1090 1094 } 1091 1095 1092 1096 static void 1093 - nvmet_fc_delete_assoc(struct work_struct *work) 1097 + nvmet_fc_delete_assoc(struct nvmet_fc_tgt_assoc *assoc) 1098 + { 1099 + nvmet_fc_delete_target_assoc(assoc); 1100 + nvmet_fc_tgt_a_put(assoc); 1101 + } 1102 + 1103 + static void 1104 + nvmet_fc_delete_assoc_work(struct work_struct *work) 1094 1105 { 1095 1106 struct nvmet_fc_tgt_assoc *assoc = 1096 1107 container_of(work, struct nvmet_fc_tgt_assoc, del_work); 1108 + struct nvmet_fc_tgtport *tgtport = assoc->tgtport; 1097 1109 1098 - nvmet_fc_delete_target_assoc(assoc); 1099 - nvmet_fc_tgt_a_put(assoc); 1110 + nvmet_fc_delete_assoc(assoc); 1111 + nvmet_fc_tgtport_put(tgtport); 1112 + } 1113 + 1114 + static void 1115 + nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc) 1116 + { 1117 + nvmet_fc_tgtport_get(assoc->tgtport); 1118 + queue_work(nvmet_wq, &assoc->del_work); 1119 + } 1120 + 1121 + static bool 1122 + nvmet_fc_assoc_exits(struct nvmet_fc_tgtport *tgtport, u64 association_id) 1123 + { 1124 + struct nvmet_fc_tgt_assoc *a; 1125 + 1126 + list_for_each_entry_rcu(a, &tgtport->assoc_list, a_list) { 1127 + if (association_id == a->association_id) 1128 + return true; 1129 + } 1130 + 1131 + return false; 1100 1132 } 1101 1133 1102 1134 static struct nvmet_fc_tgt_assoc * 1103 1135 nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) 1104 1136 { 1105 - struct nvmet_fc_tgt_assoc *assoc, *tmpassoc; 1137 + struct nvmet_fc_tgt_assoc *assoc; 1106 1138 unsigned long flags; 1139 + bool done; 1107 1140 u64 ran; 1108 1141 int idx; 1109 - bool needrandom = true; 1142 + 1143 + if (!tgtport->pe) 1144 + return NULL; 1110 1145 1111 1146 assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); 1112 1147 if (!assoc) ··· 1147 1120 if (idx < 0) 1148 1121 goto out_free_assoc; 1149 1122 1150 - if (!nvmet_fc_tgtport_get(tgtport)) 1151 - goto out_ida; 1152 - 1153 1123 assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle); 1154 1124 if (IS_ERR(assoc->hostport)) 1155 - goto out_put; 1125 + goto out_ida; 1156 1126 1157 1127 assoc->tgtport = tgtport; 1158 1128 assoc->a_id = idx; 1159 1129 INIT_LIST_HEAD(&assoc->a_list); 1160 1130 kref_init(&assoc->ref); 1161 - INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc); 1131 + INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc_work); 1162 1132 atomic_set(&assoc->terminating, 0); 1163 1133 1164 - while (needrandom) { 1134 + done = false; 1135 + do { 1165 1136 get_random_bytes(&ran, sizeof(ran) - BYTES_FOR_QID); 1166 1137 ran = ran << BYTES_FOR_QID_SHIFT; 1167 1138 1168 1139 spin_lock_irqsave(&tgtport->lock, flags); 1169 - needrandom = false; 1170 - list_for_each_entry(tmpassoc, &tgtport->assoc_list, a_list) { 1171 - if (ran == tmpassoc->association_id) { 1172 - needrandom = true; 1173 - break; 1174 - } 1175 - } 1176 - if (!needrandom) { 1140 + rcu_read_lock(); 1141 + if (!nvmet_fc_assoc_exits(tgtport, ran)) { 1177 1142 assoc->association_id = ran; 1178 1143 list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list); 1144 + done = true; 1179 1145 } 1146 + rcu_read_unlock(); 1180 1147 spin_unlock_irqrestore(&tgtport->lock, flags); 1181 - } 1148 + } while (!done); 1182 1149 1183 1150 return assoc; 1184 1151 1185 - out_put: 1186 - nvmet_fc_tgtport_put(tgtport); 1187 1152 out_ida: 1188 1153 ida_free(&tgtport->assoc_cnt, idx); 1189 1154 out_free_assoc: ··· 1191 1172 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; 1192 1173 struct nvmet_fc_ls_iod *oldls; 1193 1174 unsigned long flags; 1175 + int i; 1176 + 1177 + for (i = NVMET_NR_QUEUES; i >= 0; i--) { 1178 + if (assoc->queues[i]) 1179 + nvmet_fc_delete_target_queue(assoc->queues[i]); 1180 + } 1194 1181 1195 1182 /* Send Disconnect now that all i/o has completed */ 1196 1183 nvmet_fc_xmt_disconnect_assoc(assoc); 1197 1184 1198 1185 nvmet_fc_free_hostport(assoc->hostport); 1199 1186 spin_lock_irqsave(&tgtport->lock, flags); 1200 - list_del_rcu(&assoc->a_list); 1201 1187 oldls = assoc->rcv_disconn; 1202 1188 spin_unlock_irqrestore(&tgtport->lock, flags); 1203 1189 /* if pending Rcv Disconnect Association LS, send rsp now */ ··· 1212 1188 dev_info(tgtport->dev, 1213 1189 "{%d:%d} Association freed\n", 1214 1190 tgtport->fc_target_port.port_num, assoc->a_id); 1215 - kfree_rcu(assoc, rcu); 1216 - nvmet_fc_tgtport_put(tgtport); 1191 + kfree(assoc); 1217 1192 } 1218 1193 1219 1194 static void ··· 1231 1208 nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) 1232 1209 { 1233 1210 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; 1234 - struct nvmet_fc_tgt_queue *queue; 1211 + unsigned long flags; 1235 1212 int i, terminating; 1236 1213 1237 1214 terminating = atomic_xchg(&assoc->terminating, 1); ··· 1240 1217 if (terminating) 1241 1218 return; 1242 1219 1220 + spin_lock_irqsave(&tgtport->lock, flags); 1221 + list_del_rcu(&assoc->a_list); 1222 + spin_unlock_irqrestore(&tgtport->lock, flags); 1243 1223 1224 + synchronize_rcu(); 1225 + 1226 + /* ensure all in-flight I/Os have been processed */ 1244 1227 for (i = NVMET_NR_QUEUES; i >= 0; i--) { 1245 - rcu_read_lock(); 1246 - queue = rcu_dereference(assoc->queues[i]); 1247 - if (!queue) { 1248 - rcu_read_unlock(); 1249 - continue; 1250 - } 1251 - 1252 - if (!nvmet_fc_tgt_q_get(queue)) { 1253 - rcu_read_unlock(); 1254 - continue; 1255 - } 1256 - rcu_read_unlock(); 1257 - nvmet_fc_delete_target_queue(queue); 1258 - nvmet_fc_tgt_q_put(queue); 1228 + if (assoc->queues[i]) 1229 + flush_workqueue(assoc->queues[i]->work_q); 1259 1230 } 1260 1231 1261 1232 dev_info(tgtport->dev, 1262 1233 "{%d:%d} Association deleted\n", 1263 1234 tgtport->fc_target_port.port_num, assoc->a_id); 1264 - 1265 - nvmet_fc_tgt_a_put(assoc); 1266 1235 } 1267 1236 1268 1237 static struct nvmet_fc_tgt_assoc * ··· 1430 1415 kref_init(&newrec->ref); 1431 1416 ida_init(&newrec->assoc_cnt); 1432 1417 newrec->max_sg_cnt = template->max_sgl_segments; 1418 + INIT_WORK(&newrec->put_work, nvmet_fc_put_tgtport_work); 1433 1419 1434 1420 ret = nvmet_fc_alloc_ls_iodlist(newrec); 1435 1421 if (ret) { ··· 1508 1492 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { 1509 1493 if (!nvmet_fc_tgt_a_get(assoc)) 1510 1494 continue; 1511 - if (!queue_work(nvmet_wq, &assoc->del_work)) 1512 - /* already deleting - release local reference */ 1513 - nvmet_fc_tgt_a_put(assoc); 1495 + nvmet_fc_schedule_delete_assoc(assoc); 1496 + nvmet_fc_tgt_a_put(assoc); 1514 1497 } 1515 1498 rcu_read_unlock(); 1516 1499 } ··· 1555 1540 spin_lock_irqsave(&tgtport->lock, flags); 1556 1541 list_for_each_entry_safe(assoc, next, 1557 1542 &tgtport->assoc_list, a_list) { 1558 - if (!assoc->hostport || 1559 - assoc->hostport->hosthandle != hosthandle) 1543 + if (assoc->hostport->hosthandle != hosthandle) 1560 1544 continue; 1561 1545 if (!nvmet_fc_tgt_a_get(assoc)) 1562 1546 continue; 1563 1547 assoc->hostport->invalid = 1; 1564 1548 noassoc = false; 1565 - if (!queue_work(nvmet_wq, &assoc->del_work)) 1566 - /* already deleting - release local reference */ 1567 - nvmet_fc_tgt_a_put(assoc); 1549 + nvmet_fc_schedule_delete_assoc(assoc); 1550 + nvmet_fc_tgt_a_put(assoc); 1568 1551 } 1569 1552 spin_unlock_irqrestore(&tgtport->lock, flags); 1570 1553 ··· 1594 1581 1595 1582 rcu_read_lock(); 1596 1583 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { 1597 - queue = rcu_dereference(assoc->queues[0]); 1584 + queue = assoc->queues[0]; 1598 1585 if (queue && queue->nvme_sq.ctrl == ctrl) { 1599 1586 if (nvmet_fc_tgt_a_get(assoc)) 1600 1587 found_ctrl = true; ··· 1606 1593 nvmet_fc_tgtport_put(tgtport); 1607 1594 1608 1595 if (found_ctrl) { 1609 - if (!queue_work(nvmet_wq, &assoc->del_work)) 1610 - /* already deleting - release local reference */ 1611 - nvmet_fc_tgt_a_put(assoc); 1596 + nvmet_fc_schedule_delete_assoc(assoc); 1597 + nvmet_fc_tgt_a_put(assoc); 1612 1598 return; 1613 1599 } 1614 1600 ··· 1636 1624 1637 1625 /* terminate any outstanding associations */ 1638 1626 __nvmet_fc_free_assocs(tgtport); 1627 + 1628 + flush_workqueue(nvmet_wq); 1639 1629 1640 1630 /* 1641 1631 * should terminate LS's as well. However, LS's will be generated ··· 1884 1870 sizeof(struct fcnvme_ls_disconnect_assoc_acc)), 1885 1871 FCNVME_LS_DISCONNECT_ASSOC); 1886 1872 1887 - /* release get taken in nvmet_fc_find_target_assoc */ 1888 - nvmet_fc_tgt_a_put(assoc); 1889 - 1890 1873 /* 1891 1874 * The rules for LS response says the response cannot 1892 1875 * go back until ABTS's have been sent for all outstanding ··· 1897 1886 oldls = assoc->rcv_disconn; 1898 1887 assoc->rcv_disconn = iod; 1899 1888 spin_unlock_irqrestore(&tgtport->lock, flags); 1900 - 1901 - nvmet_fc_delete_target_assoc(assoc); 1902 1889 1903 1890 if (oldls) { 1904 1891 dev_info(tgtport->dev, ··· 1912 1903 FCNVME_RJT_EXP_NONE, 0); 1913 1904 nvmet_fc_xmt_ls_rsp(tgtport, oldls); 1914 1905 } 1906 + 1907 + nvmet_fc_schedule_delete_assoc(assoc); 1908 + nvmet_fc_tgt_a_put(assoc); 1915 1909 1916 1910 return false; 1917 1911 } ··· 2552 2540 2553 2541 fod->req.cmd = &fod->cmdiubuf.sqe; 2554 2542 fod->req.cqe = &fod->rspiubuf.cqe; 2555 - if (tgtport->pe) 2556 - fod->req.port = tgtport->pe->port; 2543 + if (!tgtport->pe) 2544 + goto transport_error; 2545 + fod->req.port = tgtport->pe->port; 2557 2546 2558 2547 /* clear any response payload */ 2559 2548 memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); ··· 2915 2902 2916 2903 nvmet_fc_portentry_unbind(pe); 2917 2904 2905 + /* terminate any outstanding associations */ 2906 + __nvmet_fc_free_assocs(pe->tgtport); 2907 + 2918 2908 kfree(pe); 2919 2909 } 2920 2910 ··· 2949 2933 2950 2934 static void __exit nvmet_fc_exit_module(void) 2951 2935 { 2936 + /* ensure any shutdown operation, e.g. delete ctrls have finished */ 2937 + flush_workqueue(nvmet_wq); 2938 + 2952 2939 /* sanity check - all lports should be removed */ 2953 2940 if (!list_empty(&nvmet_fc_target_list)) 2954 2941 pr_warn("%s: targetport list not empty\n", __func__); ··· 2964 2945 module_init(nvmet_fc_init_module); 2965 2946 module_exit(nvmet_fc_exit_module); 2966 2947 2948 + MODULE_DESCRIPTION("NVMe target FC transport driver"); 2967 2949 MODULE_LICENSE("GPL v2");
+4 -3
drivers/nvme/target/fcloop.c
··· 358 358 if (!rport->targetport) { 359 359 tls_req->status = -ECONNREFUSED; 360 360 spin_lock(&rport->lock); 361 - list_add_tail(&rport->ls_list, &tls_req->ls_list); 361 + list_add_tail(&tls_req->ls_list, &rport->ls_list); 362 362 spin_unlock(&rport->lock); 363 363 queue_work(nvmet_wq, &rport->ls_work); 364 364 return ret; ··· 391 391 if (remoteport) { 392 392 rport = remoteport->private; 393 393 spin_lock(&rport->lock); 394 - list_add_tail(&rport->ls_list, &tls_req->ls_list); 394 + list_add_tail(&tls_req->ls_list, &rport->ls_list); 395 395 spin_unlock(&rport->lock); 396 396 queue_work(nvmet_wq, &rport->ls_work); 397 397 } ··· 446 446 if (!tport->remoteport) { 447 447 tls_req->status = -ECONNREFUSED; 448 448 spin_lock(&tport->lock); 449 - list_add_tail(&tport->ls_list, &tls_req->ls_list); 449 + list_add_tail(&tls_req->ls_list, &tport->ls_list); 450 450 spin_unlock(&tport->lock); 451 451 queue_work(nvmet_wq, &tport->ls_work); 452 452 return ret; ··· 1650 1650 module_init(fcloop_init); 1651 1651 module_exit(fcloop_exit); 1652 1652 1653 + MODULE_DESCRIPTION("NVMe target FC loop transport driver"); 1653 1654 MODULE_LICENSE("GPL v2");
+6 -3
drivers/nvme/target/loop.c
··· 400 400 } 401 401 402 402 nvme_quiesce_admin_queue(&ctrl->ctrl); 403 - if (ctrl->ctrl.state == NVME_CTRL_LIVE) 403 + if (nvme_ctrl_state(&ctrl->ctrl) == NVME_CTRL_LIVE) 404 404 nvme_disable_ctrl(&ctrl->ctrl, true); 405 405 406 406 nvme_cancel_admin_tagset(&ctrl->ctrl); ··· 434 434 nvme_loop_shutdown_ctrl(ctrl); 435 435 436 436 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { 437 - if (ctrl->ctrl.state != NVME_CTRL_DELETING && 438 - ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO) 437 + enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl); 438 + 439 + if (state != NVME_CTRL_DELETING && 440 + state != NVME_CTRL_DELETING_NOIO) 439 441 /* state change failure for non-deleted ctrl? */ 440 442 WARN_ON_ONCE(1); 441 443 return; ··· 690 688 module_init(nvme_loop_init_module); 691 689 module_exit(nvme_loop_cleanup_module); 692 690 691 + MODULE_DESCRIPTION("NVMe target loop transport driver"); 693 692 MODULE_LICENSE("GPL v2"); 694 693 MODULE_ALIAS("nvmet-transport-254"); /* 254 == NVMF_TRTYPE_LOOP */
+1
drivers/nvme/target/rdma.c
··· 2104 2104 module_init(nvmet_rdma_init); 2105 2105 module_exit(nvmet_rdma_exit); 2106 2106 2107 + MODULE_DESCRIPTION("NVMe target RDMA transport driver"); 2107 2108 MODULE_LICENSE("GPL v2"); 2108 2109 MODULE_ALIAS("nvmet-transport-1"); /* 1 == NVMF_TRTYPE_RDMA */
+2
drivers/nvme/target/tcp.c
··· 2216 2216 flush_workqueue(nvmet_wq); 2217 2217 2218 2218 destroy_workqueue(nvmet_tcp_wq); 2219 + ida_destroy(&nvmet_tcp_queue_ida); 2219 2220 } 2220 2221 2221 2222 module_init(nvmet_tcp_init); 2222 2223 module_exit(nvmet_tcp_exit); 2223 2224 2225 + MODULE_DESCRIPTION("NVMe target TCP transport driver"); 2224 2226 MODULE_LICENSE("GPL v2"); 2225 2227 MODULE_ALIAS("nvmet-transport-3"); /* 3 == NVMF_TRTYPE_TCP */
+2 -8
include/linux/nvme.h
··· 816 816 struct nvme_registered_ctrl_ext regctl_eds[]; 817 817 }; 818 818 819 - enum nvme_async_event_type { 820 - NVME_AER_TYPE_ERROR = 0, 821 - NVME_AER_TYPE_SMART = 1, 822 - NVME_AER_TYPE_NOTICE = 2, 823 - }; 824 - 825 819 /* I/O commands */ 826 820 827 821 enum nvme_opcode { ··· 1812 1818 }; 1813 1819 }; 1814 1820 1815 - static inline bool nvme_is_fabrics(struct nvme_command *cmd) 1821 + static inline bool nvme_is_fabrics(const struct nvme_command *cmd) 1816 1822 { 1817 1823 return cmd->common.opcode == nvme_fabrics_command; 1818 1824 } ··· 1831 1837 __u8 resv2[24]; 1832 1838 }; 1833 1839 1834 - static inline bool nvme_is_write(struct nvme_command *cmd) 1840 + static inline bool nvme_is_write(const struct nvme_command *cmd) 1835 1841 { 1836 1842 /* 1837 1843 * What a mess...