[PATCH] nvme-fabrics: check max outstanding commands

Keith Busch kbusch at kernel.org
Tue Feb 27 09:46:08 PST 2024


On Fri, Feb 23, 2024 at 11:30:04AM +0800, Guixin Liu wrote:
> Maxcmd is mandatory for fabrics, check it early to identify the root
> cause instead of waiting for it to propagate to "sqsize" and "allocing
> queue".
> 
> By the way, change nvme_check_ctrl_fabric_info() to
> nvmf_validate_identify_ctrl().
> 
> Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
> ---
>  drivers/nvme/host/core.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0a96362912ce..5cdd22f591f9 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3084,7 +3084,8 @@ static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
>  	return 0;
>  }
>  
> -static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> +static int nvmf_validate_identify_ctrl(struct nvme_ctrl *ctrl,
> +				       struct nvme_id_ctrl *id)
>  {
>  	/*
>  	 * In fabrics we need to verify the cntlid matches the
> @@ -3117,6 +3118,11 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
>  		return -EINVAL;
>  	}
>  
> +	if (!ctrl->maxcmd) {
> +		dev_err(ctrl->device, "Maximum outstanding commands is 0\n");
> +		return -EINVAL;
> +	}

This part seems fine, but I don't think you need to change the name of
the function for this addition.



More information about the Linux-nvme mailing list