public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Ming Lei <ming.lei@redhat.com>, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org
Cc: Marco Patalano <mpatalan@redhat.com>,
	Ewan Milne <emilne@redhat.com>,
	James Smart <james.smart@broadcom.com>,
	Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [RFC PATCH] nvme-fc: move tagset removal to nvme_fc_delete_ctrl()
Date: Mon, 20 Jan 2025 14:51:24 +0100	[thread overview]
Message-ID: <ace57dd5-76ad-4c8d-9cfb-97ce3105f709@suse.de> (raw)
In-Reply-To: <20250113124446.830697-1-ming.lei@redhat.com>

On 1/13/25 13:44, Ming Lei wrote:
> Now target is removed from nvme_fc_ctrl_free() which is the ctrl->ref
> release handler. And even admin queue is unquiesced there, this way
> is definitely wrong because the ctr->ref is grabbed when submitting
> command.
> 
> And Marco observed that nvme_fc_ctrl_free() can be called from request
> completion code path, and trigger kernel warning since request completes
> from softirq context.
> 
> Fix the issue by moveing target removal into nvme_fc_delete_ctrl(),
> which is also aligned with nvme-tcp and nvme-rdma.
> 
> Cc: Marco Patalano <mpatalan@redhat.com>
> Cc: Ewan Milne <emilne@redhat.com>
> Cc: James Smart <james.smart@broadcom.com>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>   drivers/nvme/host/fc.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index b81af7919e94..b94b4e50a3df 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -2389,17 +2389,11 @@ nvme_fc_ctrl_free(struct kref *ref)
>   		container_of(ref, struct nvme_fc_ctrl, ref);
>   	unsigned long flags;
>   
> -	if (ctrl->ctrl.tagset)
> -		nvme_remove_io_tag_set(&ctrl->ctrl);
> -
>   	/* remove from rport list */
>   	spin_lock_irqsave(&ctrl->rport->lock, flags);
>   	list_del(&ctrl->ctrl_list);
>   	spin_unlock_irqrestore(&ctrl->rport->lock, flags);
>   
> -	nvme_unquiesce_admin_queue(&ctrl->ctrl);
> -	nvme_remove_admin_tag_set(&ctrl->ctrl);
> -
>   	kfree(ctrl->queues);
>   
>   	put_device(ctrl->dev);
> @@ -3288,6 +3282,13 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
>   
>   	cancel_work_sync(&ctrl->ioerr_work);
>   	cancel_delayed_work_sync(&ctrl->connect_work);
> +
> +	if (ctrl->ctrl.tagset)
> +		nvme_remove_io_tag_set(&ctrl->ctrl);
> +
> +	nvme_unquiesce_admin_queue(&ctrl->ctrl);
> +	nvme_remove_admin_tag_set(&ctrl->ctrl);
> +
>   	/*
>   	 * kill the association on the link side.  this will block
>   	 * waiting for io to terminate

Not sure that'll work. We're waiting for I/Os to complete just after
the line in the last hunk, and I guess the need a tagset to complete
properly.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich


      parent reply	other threads:[~2025-01-20 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 12:44 [RFC PATCH] nvme-fc: move tagset removal to nvme_fc_delete_ctrl() Ming Lei
2025-01-14 17:06 ` Ewan Milne
2025-01-14 18:31   ` Ewan Milne
2025-01-15 17:33     ` Ewan Milne
2025-01-16  1:57       ` Ming Lei
2025-01-17 22:03         ` Ewan Milne
2025-01-16  6:10 ` Christoph Hellwig
2025-01-17 22:06   ` Ewan Milne
2025-01-20 13:51 ` Hannes Reinecke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ace57dd5-76ad-4c8d-9cfb-97ce3105f709@suse.de \
    --to=hare@suse.de \
    --cc=emilne@redhat.com \
    --cc=hch@lst.de \
    --cc=james.smart@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ming.lei@redhat.com \
    --cc=mpatalan@redhat.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox