[PATCH 1/2] nvme: move error logging from nvme_end_req() to __nvme_end_req()

Hannes Reinecke hare at suse.de
Mon Mar 10 23:51:29 PDT 2025


On 3/11/25 03:41, Shin'ichiro Kawasaki wrote:
> Before the Commit 1f47ed294a2b ("block: cleanup and fix batch completion
> adding conditions"), blk_mq_add_to_batch() did not add failed
> passthrough requests to batch, and returned false. After the commit,
> blk_mq_add_to_batch() always adds passthrough requests to batch
> regardless of whether the request failed or not, and returns true. This
> affected error logging feature in the NVME driver.
> 
> Before the commit, the call chain of failed passthrough request was as
> follows:
> 
> nvme_handle_cqe()
>   blk_mq_add_to_batch() .. false is returned, then call nvme_pci_complete_rq()
>   nvme_pci_complete_rq()
>    nvme_complete_rq()
>     nvme_end_req()
>      nvme_log_err_passthru() .. error logging
>      __nvme_end_req()        .. end of the rqeuest
> 
> After the commit, the call chain is as follows:
> 
> nvme_handle_cqe()
>   blk_mq_add_to_batch() .. true is returned, then set nvme_pci_complete_batch()
>   ..
>   nvme_pci_complete_batch()
>    nvme_complete_batch()
>     nvme_complete_batch_req()
>      __nvme_end_req() .. end of the request, without error logging
> 
> To make the error logging feature work again for passthrough requests, move the
> nvme_log_err_passthru() call from nvme_end_req() to __nvme_end_req().
> 
> While at it, move nvme_log_error() call for non-passthrough requests together
> with nvme_log_err_passthru(). Even though the trigger commit does not affect
> non-passthrough requests, move it together for code simplicity.
> 
> Fixes: 1f47ed294a2b ("block: cleanup and fix batch completion adding conditions")
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
> ---
>   drivers/nvme/host/core.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

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