Re: [PATCH] nvme: Move nvme_setup_cmd before hot_pathing

From: Justin Tee

Date: Tue Mar 24 2026 - 19:57:00 EST


Hi Minsik,

> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index e1bb4707183c..8ea37102a836 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -2762,14 +2762,14 @@ nvme_fc_queue_rq(struct blk_mq_hw_ctx *hctx,
>         u32 data_len;
>         blk_status_t ret;
>
> -       if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE ||
> -           !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready))
> -               return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq);
> -
>         ret = nvme_setup_cmd(ns, rq);
>         if (ret)
>                 return ret;
>
> +       if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE ||
> +           !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready))
> +               return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq);
> +

__nvme_check_ready() checks for (nvme_req(req)->flags & NVME_REQ_USERCMD).  In nvme_setup_cmd(), nvme_clear_nvme_request() clears the nvme_req(req)->flags when RQF_DONTPREP is not set.

Is it possible that this patch would have nvme_setup_cmd() erase a nvme_req(req)’s NVME_REQ_USERCMD flag before __nvme_check_ready() is called for each respective .queue_rq?

Regards,
Justin Tee