nvmet-fc: take tgtport reference only once
authorDaniel Wagner <wagi@kernel.org>
Tue, 8 Apr 2025 15:29:09 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:59:24 +0000 (07:59 +0200)
commit9635d486b608ef2952bcfee3e0f1e7948b37fb09
tree8c82518cb718705a7093cb9cac53aee8b0393edf
parentbb4b487bbd292742f658d7851fcf4c7576813a94
nvmet-fc: take tgtport reference only once

[ Upstream commit b0b26ad0e1943de25ce82a7e5af3574f31b1cf99 ]

The reference counting code can be simplified. Instead taking a tgtport
refrerence at the beginning of nvmet_fc_alloc_hostport and put it back
if not a new hostport object is allocated, only take it when a new
hostport object is allocated.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/target/fc.c