Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH] nvme-fc: allow support for association_id to be zero
Date: Sat, 27 Oct 2018 12:42:45 -0700	[thread overview]
Message-ID: <20181027194245.4246-1-jsmart2021@gmail.com> (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

             reply	other threads:[~2018-10-27 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 19:42 James Smart [this message]
2018-10-30 19:41 ` [PATCH] nvme-fc: allow support for association_id to be zero Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181027194245.4246-1-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox