2024-02-07 22:03:06

by Sasha Levin

[permalink] [raw]
Subject: [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc

From: Daniel Wagner <[email protected]>

[ 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 <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Daniel Wagner <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/nvme/target/fc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 18a64a4fd8da..ebbc513682e1 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1110,12 +1110,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;
@@ -1145,8 +1142,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_simple_remove(&tgtport->assoc_cnt, idx);
out_free_assoc:
--
2.43.0



2024-02-18 19:09:05

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc

Hi!

> From: Daniel Wagner <[email protected]>
>
> [ 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.

I don't see this one queued for 6.1 or 6.6. What went wrong here?

Best regards,
Pavel

> +++ b/drivers/nvme/target/fc.c
> @@ -1110,12 +1110,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;
> @@ -1145,8 +1142,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_simple_remove(&tgtport->assoc_cnt, idx);
> out_free_assoc:

--
People of Russia, stop Putin before his war on Ukraine escalates.


Attachments:
(No filename) (1.15 kB)
signature.asc (201.00 B)
Download all attachments

2024-02-22 12:24:16

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc

On Sun, Feb 18, 2024 at 08:08:51PM +0100, Pavel Machek wrote:
>Hi!
>
>> From: Daniel Wagner <[email protected]>
>>
>> [ 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.
>
>I don't see this one queued for 6.1 or 6.6. What went wrong here?

Yup, this should have been dropped from all trees. Thanks!


--
Thanks,
Sasha