nvme-fc: allow support for association_id to be zero
Subsystems (2)
PATCH 1/1 nvme-fc: allow support for association_id to be zero
Current code assumed association_id would be some non-zero value. But zero isn't prohibited by spec. Add support for the value being zero.
Signed-off-by James Smart <jsmart2021 at gmail.com>
--- drivers/nvme/host/fc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +5 -2
@@ -152,6 +152,7 @@ struct nvme_fc_ctrl {bool ioq_live;bool assoc_active; +bool assoc_id_valid;u64 association_id;struct list_head ctrl_list;/* rport->ctrl_list */
@@ -1274,6 +1275,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, }else { ctrl->association_id =be64_to_cpu (assoc_acc->associd.association_id); + ctrl->assoc_id_valid = true; queue->connection_id =be64_to_cpu (assoc_acc->connectid.connection_id);set_bit (NVME_FC_Q_CONNECTED , &queue->flags);
@@ -1471,6 +1473,7 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)kfree (lsop);/* only meaningful part to terminating the association */ + ctrl->assoc_id_valid = false; ctrl->association_id =0 ; }
@@ -2787,9 +2790,8 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)* send a Disconnect(association) LS to fc-nvme target * Note: could have been sent at top of process, but * cleaner on link traffic if after the aborts complete. -* Note: if association doesn't exist, association_id will be 0 */ -if (ctrl->association_id) +if (ctrl->assoc_id_valid)nvme_fc_xmt_disconnect_assoc (ctrl);if (ctrl->ctrl.tagset) {
@@ -3007,6 +3009,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, ctrl->cnum = idx; ctrl->ioq_live = false; ctrl->assoc_active = false; + ctrl->assoc_id_valid = false;init_waitqueue_head (&ctrl->ioabort_wait);get_device (ctrl->dev);
Signature · 1 line
2.13.7
Sagi Grimberg
maintainerPATCH 1/1 nvme-fc: allow support for association_id to be zero
Reviewed-by Sagi Grimberg <sagi at grimberg.me>