[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207212142.1399-37-sashal@kernel.org>
Date: Wed, 7 Feb 2024 16:21:04 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Daniel Wagner <dwagner@...e.de>,
Hannes Reinecke <hare@...e.de>,
Christoph Hellwig <hch@....de>,
Keith Busch <kbusch@...nel.org>,
Sasha Levin <sashal@...nel.org>,
james.smart@...adcom.com,
sagi@...mberg.me,
kch@...dia.com,
linux-nvme@...ts.infradead.org
Subject: [PATCH AUTOSEL 6.7 37/44] nvmet-fc: do not tack refs on tgtports from assoc
From: Daniel Wagner <dwagner@...e.de>
[ Upstream commit 1c110588dd95d21782397ff3cbaa55820b4e1fad ]
The association life time is tied to the life time of the target port.
That means we should not take extra a refcount when creating a
association.
Reviewed-by: Hannes Reinecke <hare@...e.de>
Reviewed-by: Christoph Hellwig <hch@....de>
Signed-off-by: Daniel Wagner <dwagner@...e.de>
Signed-off-by: Keith Busch <kbusch@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/nvme/target/fc.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 6d111b03d371..d50af99e847d 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1108,12 +1108,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
if (idx < 0)
goto out_free_assoc;
- if (!nvmet_fc_tgtport_get(tgtport))
- goto out_ida;
-
assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle);
if (IS_ERR(assoc->hostport))
- goto out_put;
+ goto out_ida;
assoc->tgtport = tgtport;
assoc->a_id = idx;
@@ -1143,8 +1140,6 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
return assoc;
-out_put:
- nvmet_fc_tgtport_put(tgtport);
out_ida:
ida_free(&tgtport->assoc_cnt, idx);
out_free_assoc:
@@ -1181,7 +1176,6 @@ nvmet_fc_target_assoc_free(struct kref *ref)
dev_info(tgtport->dev,
"{%d:%d} Association freed\n",
tgtport->fc_target_port.port_num, assoc->a_id);
- nvmet_fc_tgtport_put(tgtport);
kfree(assoc);
}
--
2.43.0
Powered by blists - more mailing lists