[RFC PATCH 14/14] nvme-fc: Hold inflight requests while in RECOVERING state

Randy Jennings randyj at purestorage.com
Fri Dec 19 17:44:50 PST 2025


On Tue, Nov 25, 2025 at 6:13 PM Mohamed Khalfella
<mkhalfella at purestorage.com> wrote:

> Signed-off-by: Mohamed Khalfella <mkhalfella at purestorage.com>

> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c

> @@ -2083,17 +2092,34 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)

> +       /*
> +        * We can not access op after the request is completed because it can
> +        * be reused immediately. At the same time we want to wakeup the thread
> +        * waiting for ongoing IOs _after_ requests are completed. This is
> +        * necessary because that thread will start canceling inflight IOs
> +        * and we want to avoid request completion racing with cancellation.
> +        */
> +       op_term = __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
> +
> +       /* Error recovery completes inflight reqeusts when it is safe */
"reqeusts" -> "requests"

> +       if (nvme_ctrl_state(&ctrl->ctrl) == NVME_CTRL_RECOVERING)
> +               goto check_op_term;
> +
>         if (!nvme_try_complete_req(rq, status, result))
>                 nvme_fc_complete_rq(rq);
>
> +check_op_term:
> +       if (op_term)
> +               __nvme_fc_fcpop_count_one_down(ctrl);

I think it is easier to grok:
+       op_term = __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
+
+       /* Error recovery completes inflight reqeusts when it is safe */
+       if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_RECOVERING &&
+           !nvme_try_complete_req(rq, status, result))
                nvme_fc_complete_rq(rq);
+
+       if (op_term)
+               __nvme_fc_fcpop_count_one_down(ctrl);

Reviewed-by: Randy Jennings <randyj at purestorage.com>



More information about the Linux-nvme mailing list