* [PATCH] nvme-fc: allow support for association_id to be zero
@ 2018-10-27 19:42 James Smart
2018-10-30 19:41 ` Sagi Grimberg
0 siblings, 1 reply; 2+ messages in thread
From: James Smart @ 2018-10-27 19:42 UTC (permalink / raw)
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(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index e52b9d3c0bd6..fd6899e9fa2b 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -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);
--
2.13.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] nvme-fc: allow support for association_id to be zero
2018-10-27 19:42 [PATCH] nvme-fc: allow support for association_id to be zero James Smart
@ 2018-10-30 19:41 ` Sagi Grimberg
0 siblings, 0 replies; 2+ messages in thread
From: Sagi Grimberg @ 2018-10-30 19:41 UTC (permalink / raw)
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-30 19:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-27 19:42 [PATCH] nvme-fc: allow support for association_id to be zero James Smart
2018-10-30 19:41 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox