[PATCH] nvmet: drop the redundant auth check in nvmet_parse_io_cmd()

Hannes Reinecke hare at suse.de
Tue Nov 10 04:56:34 PST 2026


On 11/4/26 2:14 PM, shao.mingyin at zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin at zte.com.cn>
> 
> nvmet_parse_io_cmd() calls nvmet_check_auth_status() and then
> nvmet_check_ctrl_status(), which performs the same check again.  The
> first call cannot fail either: this path only handles commands from I/O
> queues, and nvmet_check_auth_status() returns true unconditionally for
> qid > 0.  Drop the duplicate.
> 
> No functional change.
> 
> Signed-off-by: Shao Mingyin <shao.mingyin at zte.com.cn>
> ---
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index a8171b88035c..12b82bb7e412 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1120,9 +1120,6 @@ static u16 nvmet_parse_io_cmd(struct nvmet_req *req)
>   	if (nvme_is_fabrics(cmd))
>   		return nvmet_parse_fabrics_io_cmd(req);
>   
> -	if (unlikely(!nvmet_check_auth_status(req)))
> -		return NVME_SC_AUTH_REQUIRED | NVME_STATUS_DNR;
> -
>   	ret = nvmet_check_ctrl_status(req);
>   	if (unlikely(ret))
>   		return ret;
> 

If you insist ...

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