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

From: Randy Jennings

Date: Fri Dec 19 2025 - 20:45:01 EST


On Tue, Nov 25, 2025 at 6:13 PM Mohamed Khalfella
<mkhalfella@xxxxxxxxxxxxxxx> wrote:

> Signed-off-by: Mohamed Khalfella <mkhalfella@xxxxxxxxxxxxxxx>

> 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@xxxxxxxxxxxxxxx>