Skip to content

Commit 1c11058

Browse files
igawkeithbusch
authored andcommitted
nvmet-fc: do not tack refs on tgtports from assoc
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>
1 parent 50b474e commit 1c11058

File tree

1 file changed

+1
-7
lines changed
  • drivers/nvme/target

1 file changed

+1
-7
lines changed

drivers/nvme/target/fc.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,12 +1107,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
11071107
if (idx < 0)
11081108
goto out_free_assoc;
11091109

1110-
if (!nvmet_fc_tgtport_get(tgtport))
1111-
goto out_ida;
1112-
11131110
assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle);
11141111
if (IS_ERR(assoc->hostport))
1115-
goto out_put;
1112+
goto out_ida;
11161113

11171114
assoc->tgtport = tgtport;
11181115
assoc->a_id = idx;
@@ -1142,8 +1139,6 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
11421139

11431140
return assoc;
11441141

1145-
out_put:
1146-
nvmet_fc_tgtport_put(tgtport);
11471142
out_ida:
11481143
ida_free(&tgtport->assoc_cnt, idx);
11491144
out_free_assoc:
@@ -1180,7 +1175,6 @@ nvmet_fc_target_assoc_free(struct kref *ref)
11801175
dev_info(tgtport->dev,
11811176
"{%d:%d} Association freed\n",
11821177
tgtport->fc_target_port.port_num, assoc->a_id);
1183-
nvmet_fc_tgtport_put(tgtport);
11841178
kfree(assoc);
11851179
}
11861180

0 commit comments

Comments
 (0)