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

nvme: display correct subsystem NQN

With discovery controllers supporting unique subsystem NQNs the
actual subsystem NQN might be different from that one passed in
via the connect args. So add a helper to display the resulting
subsystem NQN.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Hannes Reinecke and committed by
Christoph Hellwig
e5ea42fa 20e8b689

+11 -4
+1 -1
drivers/nvme/host/core.c
··· 222 222 static void nvme_do_delete_ctrl(struct nvme_ctrl *ctrl) 223 223 { 224 224 dev_info(ctrl->device, 225 - "Removing ctrl: NQN \"%s\"\n", ctrl->opts->subsysnqn); 225 + "Removing ctrl: NQN \"%s\"\n", nvmf_ctrl_subsysnqn(ctrl)); 226 226 227 227 flush_work(&ctrl->reset_work); 228 228 nvme_stop_ctrl(ctrl);
+7
drivers/nvme/host/fabrics.h
··· 179 179 return true; 180 180 } 181 181 182 + static inline char *nvmf_ctrl_subsysnqn(struct nvme_ctrl *ctrl) 183 + { 184 + if (!ctrl->subsys) 185 + return ctrl->opts->subsysnqn; 186 + return ctrl->subsys->subnqn; 187 + } 188 + 182 189 int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val); 183 190 int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val); 184 191 int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val);
+1 -1
drivers/nvme/host/fc.c
··· 3596 3596 3597 3597 dev_info(ctrl->ctrl.device, 3598 3598 "NVME-FC{%d}: new ctrl: NQN \"%s\"\n", 3599 - ctrl->cnum, ctrl->ctrl.opts->subsysnqn); 3599 + ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl)); 3600 3600 3601 3601 return &ctrl->ctrl; 3602 3602
+1 -1
drivers/nvme/host/rdma.c
··· 2393 2393 goto out_uninit_ctrl; 2394 2394 2395 2395 dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs\n", 2396 - ctrl->ctrl.opts->subsysnqn, &ctrl->addr); 2396 + nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr); 2397 2397 2398 2398 mutex_lock(&nvme_rdma_ctrl_mutex); 2399 2399 list_add_tail(&ctrl->list, &nvme_rdma_ctrl_list);
+1 -1
drivers/nvme/host/tcp.c
··· 2582 2582 goto out_uninit_ctrl; 2583 2583 2584 2584 dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISp\n", 2585 - ctrl->ctrl.opts->subsysnqn, &ctrl->addr); 2585 + nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr); 2586 2586 2587 2587 mutex_lock(&nvme_tcp_ctrl_mutex); 2588 2588 list_add_tail(&ctrl->list, &nvme_tcp_ctrl_list);