[PATCH] nvme-fc: do not warn on controller removal race
Hannes Reinecke
hare at suse.de
Mon Sep 21 05:55:51 PDT 2026
On 9/8/26 4:34 PM, Maurizio Lombardi wrote:
> In nvme_fc_reconnect_or_delete(), the system attempts to remove
> the controller when reconnect limits are reached by calling
> nvme_delete_ctrl(). This call is currently wrapped in a WARN_ON().
>
> If a user concurrently deletes the controller via sysfs, the
> controller's state may have already transitioned out of the
> CONNECTING state. When this happens, nvme_delete_ctrl() correctly
> rejects the operation and returns -EBUSY. Because of the WARN_ON()
> wrapper, this race condition triggers an unnecessary kernel warning
> stack trace.
>
> Remove the WARN_ON() macro around nvme_delete_ctrl();
> this allows the system to safely ignore the -EBUSY return value
> if the controller is already being deleted.
>
> Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
> ---
> drivers/nvme/host/fc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 48454cb7a0fc..3a4030bcfab7 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -3338,7 +3338,7 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
> ctrl->cnum, min_t(int, portptr->dev_loss_tmo,
> (ctrl->ctrl.opts->max_reconnects *
> ctrl->ctrl.opts->reconnect_delay)));
> - WARN_ON(nvme_delete_ctrl(&ctrl->ctrl));
> + nvme_delete_ctrl(&ctrl->ctrl);
> }
> }
>
Reviewed-by: Hannes Reinecke <hare at kernel.org>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at 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
More information about the Linux-nvme
mailing list