Skip to contentSkip to conversation

nvme_fc: remove extra controller reference taken on reconnect

PATCH New [email protected] 2 participants 2 messages May 4, 2017 – May 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme_fc: remove extra controller reference taken on reconnect

From: James Smart <[email protected]>

remove extra controller reference taken on reconnect

Signed-off-by James Smart <james.smart at broadcom.com>
---
 drivers/nvme/host/fc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +3 -2
index 622cac5f5db5..9993ff8d5656 100644
@@ -2395,13 +2395,14 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
 			goto out_term_aen_ops;
 	}
 
+	if (ctrl->ctrl.state == NVME_CTRL_NEW)
+		kref_get(&ctrl->ctrl.kref);
+
 	changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
 	WARN_ON_ONCE(!changed);
 
 	ctrl->ctrl.opts->nr_reconnects = 0;
 
-	kref_get(&ctrl->ctrl.kref);
-
 	if (ctrl->queue_count > 1) {
 		nvme_start_queues(&ctrl->ctrl);
 		nvme_queue_scan(&ctrl->ctrl);
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 nvme_fc: remove extra controller reference taken on reconnect

Quoted 3 lines · On Thu, May 04, 2017@11:06:54AM -0700, [email protected] wrote:

From: James Smart <jsmart2021 at gmail.com>

remove extra controller reference taken on reconnect

I think proper fix would be to move the kref_get into nvme_fc_init_ctrl just after the call to nvme_fc_create_association.