public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
@ 2025-12-20  0:18 Chaitanya Kulkarni
  2026-01-06 18:28 ` Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chaitanya Kulkarni @ 2025-12-20  0:18 UTC (permalink / raw)
  To: linux-nvme
  Cc: justin.tee, nareshgottumukkala83, paul.ely, kbusch, axboe, hch,
	sagi, yi.zhang, Chaitanya Kulkarni

nvme_fabrics creates an NVMe/FC controller in following path:

    nvmf_dev_write()
      -> nvmf_create_ctrl()
        -> nvme_fc_create_ctrl()
          -> nvme_fc_init_ctrl()

nvme_fc_init_ctrl() allocates the admin blk-mq resources right after
nvme_add_ctrl() succeeds.  If any of the subsequent steps fail (changing
the controller state, scheduling connect work, etc.), we jump to the
fail_ctrl path, which tears down the controller references but never
frees the admin queue/tag set.  The leaked blk-mq allocations match the
kmemleak report seen during blktests nvme/fc.

Check ctrl->ctrl.admin_tagset in the fail_ctrl path and call
nvme_remove_admin_tag_set() when it is set so that all admin queue
allocations are reclaimed whenever controller setup aborts.

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
---
 drivers/nvme/host/fc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index bc455fa98246..6948de3f438a 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3587,6 +3587,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
 	ctrl->ctrl.opts = NULL;
 
+	if (ctrl->ctrl.admin_tagset)
+		nvme_remove_admin_tag_set(&ctrl->ctrl);
 	/* initiate nvme ctrl ref counting teardown */
 	nvme_uninit_ctrl(&ctrl->ctrl);
 
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2025-12-20  0:18 [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails Chaitanya Kulkarni
@ 2026-01-06 18:28 ` Chaitanya Kulkarni
  2026-01-07  1:37   ` Justin Tee
  2026-01-08 22:51 ` Justin Tee
  2026-01-09 14:54 ` Keith Busch
  2 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2026-01-06 18:28 UTC (permalink / raw)
  To: Chaitanya Kulkarni, nareshgottumukkala83@gmail.com,
	justin.tee@broadcom.com, linux-nvme@lists.infradead.org,
	paul.ely@broadcom.com
  Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	yi.zhang@redhat.com

On 12/19/25 16:18, Chaitanya Kulkarni wrote:
> nvme_fabrics creates an NVMe/FC controller in following path:
>
>      nvmf_dev_write()
>        -> nvmf_create_ctrl()
>          -> nvme_fc_create_ctrl()
>            -> nvme_fc_init_ctrl()
>
> nvme_fc_init_ctrl() allocates the admin blk-mq resources right after
> nvme_add_ctrl() succeeds.  If any of the subsequent steps fail (changing
> the controller state, scheduling connect work, etc.), we jump to the
> fail_ctrl path, which tears down the controller references but never
> frees the admin queue/tag set.  The leaked blk-mq allocations match the
> kmemleak report seen during blktests nvme/fc.
>
> Check ctrl->ctrl.admin_tagset in the fail_ctrl path and call
> nvme_remove_admin_tag_set() when it is set so that all admin queue
> allocations are reclaimed whenever controller setup aborts.
>
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
> ---

Gentle ping on this before it gets lost ...

-ck



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2026-01-06 18:28 ` Chaitanya Kulkarni
@ 2026-01-07  1:37   ` Justin Tee
  2026-01-08  2:10     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Justin Tee @ 2026-01-07  1:37 UTC (permalink / raw)
  To: yi.zhang@redhat.com
  Cc: Chaitanya Kulkarni, Chaitanya Kulkarni, kbusch@kernel.org,
	axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, justin.tee@broadcom.com,
	nareshgottumukkala83@gmail.com, paul.ely@broadcom.com

Hi Yi,

Was there a specific nvme/fc blktest case that triggered this call 
trace?  Or, was this observed after stress running all nvme/fc blktests 
in a loop?

Regards,
Justin Tee



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2026-01-07  1:37   ` Justin Tee
@ 2026-01-08  2:10     ` Chaitanya Kulkarni
  2026-01-08 22:49       ` Justin Tee
  0 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2026-01-08  2:10 UTC (permalink / raw)
  To: Justin Tee, yi.zhang@redhat.com
  Cc: Chaitanya Kulkarni, kbusch@kernel.org, axboe@kernel.dk,
	hch@lst.de, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	justin.tee@broadcom.com, nareshgottumukkala83@gmail.com,
	paul.ely@broadcom.com

On 1/6/26 17:37, Justin Tee wrote:
> Hi Yi,
>
> Was there a specific nvme/fc blktest case that triggered this call 
> trace?  Or, was this observed after stress running all nvme/fc 
> blktests in a loop?
>
> Regards,
> Justin Tee
>
thanks for looking into this, it was observed when Yi reported the issue.

Irrespective of whether it is repro issue, it's still a bug ?

Can you please provide review comments ?

-ck

  


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2026-01-08  2:10     ` Chaitanya Kulkarni
@ 2026-01-08 22:49       ` Justin Tee
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Tee @ 2026-01-08 22:49 UTC (permalink / raw)
  To: Chaitanya Kulkarni, yi.zhang@redhat.com
  Cc: Chaitanya Kulkarni, kbusch@kernel.org, axboe@kernel.dk,
	hch@lst.de, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	justin.tee@broadcom.com, nareshgottumukkala83@gmail.com,
	paul.ely@broadcom.com

 > thanks for looking into this, it was observed when Yi reported the issue.
 >
 > Irrespective of whether it is repro issue, it's still a bug ?
 >
 > Can you please provide review comments ?

Yes, agreed after reviewing the current goto fail_ctrl path that there 
is a missing nvme_remove_admin_tag_set.  I can provide the Reviewed-by 
stamp.

I guess I’d prefer if we can prove this resolves the issue Yi reported.  
If Yi could re-rerun nvme-fc blktests on the original failing setup with 
this patch, that would be great to confirm.

Thanks,
Justin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2025-12-20  0:18 [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails Chaitanya Kulkarni
  2026-01-06 18:28 ` Chaitanya Kulkarni
@ 2026-01-08 22:51 ` Justin Tee
  2026-01-09 14:54 ` Keith Busch
  2 siblings, 0 replies; 7+ messages in thread
From: Justin Tee @ 2026-01-08 22:51 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-nvme
  Cc: justin.tee, nareshgottumukkala83, paul.ely, kbusch, axboe, hch,
	sagi, yi.zhang

Reviewed-by: Justin Tee <justin.tee@broadcom.com>

Regards,
Justin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails
  2025-12-20  0:18 [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails Chaitanya Kulkarni
  2026-01-06 18:28 ` Chaitanya Kulkarni
  2026-01-08 22:51 ` Justin Tee
@ 2026-01-09 14:54 ` Keith Busch
  2 siblings, 0 replies; 7+ messages in thread
From: Keith Busch @ 2026-01-09 14:54 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-nvme, justin.tee, nareshgottumukkala83, paul.ely, axboe,
	hch, sagi, yi.zhang

On Fri, Dec 19, 2025 at 04:18:42PM -0800, Chaitanya Kulkarni wrote:
> nvme_fabrics creates an NVMe/FC controller in following path:
> 
>     nvmf_dev_write()
>       -> nvmf_create_ctrl()
>         -> nvme_fc_create_ctrl()
>           -> nvme_fc_init_ctrl()
> 
> nvme_fc_init_ctrl() allocates the admin blk-mq resources right after
> nvme_add_ctrl() succeeds.  If any of the subsequent steps fail (changing
> the controller state, scheduling connect work, etc.), we jump to the
> fail_ctrl path, which tears down the controller references but never
> frees the admin queue/tag set.  The leaked blk-mq allocations match the
> kmemleak report seen during blktests nvme/fc.
> 
> Check ctrl->ctrl.admin_tagset in the fail_ctrl path and call
> nvme_remove_admin_tag_set() when it is set so that all admin queue
> allocations are reclaimed whenever controller setup aborts.

Thanks, applied.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-09 14:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-20  0:18 [BUG FIX PATCH COMPILE TESTED ONLY] nvme-fc: release admin tagset if init fails Chaitanya Kulkarni
2026-01-06 18:28 ` Chaitanya Kulkarni
2026-01-07  1:37   ` Justin Tee
2026-01-08  2:10     ` Chaitanya Kulkarni
2026-01-08 22:49       ` Justin Tee
2026-01-08 22:51 ` Justin Tee
2026-01-09 14:54 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox