Skip to content

Commit

Permalink
nvmet-fc: do not tack refs on tgtports from assoc
Browse files Browse the repository at this point in the history
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@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
  • Loading branch information
Daniel Wagner authored and Keith Busch committed Feb 1, 2024
1 parent 50b474e commit 1c11058
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/nvme/target/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,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;
Expand Down Expand Up @@ -1142,8 +1139,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:
Expand Down Expand Up @@ -1180,7 +1175,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);
}

Expand Down

0 comments on commit 1c11058

Please sign in to comment.