Skip to content

Commit 268dfb9

Browse files
author
Ming Lei
committed
nvme: move error logging from nvme_end_req() to __nvme_end_req()
JIRA: https://issues.redhat.com/browse/RHEL-79409 commit e5c2bcc Author: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Date: Tue Mar 11 19:43:58 2025 +0900 nvme: move error logging from nvme_end_req() to __nvme_end_req() Before the Commit 1f47ed2 ("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: 1f47ed2 ("block: cleanup and fix batch completion adding conditions") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250311104359.1767728-2-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 6551d1e commit 268dfb9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/nvme/host/core.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ static inline void nvme_end_req_zoned(struct request *req)
423423

424424
static inline void __nvme_end_req(struct request *req)
425425
{
426+
if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) {
427+
if (blk_rq_is_passthrough(req))
428+
nvme_log_err_passthru(req);
429+
else
430+
nvme_log_error(req);
431+
}
426432
nvme_end_req_zoned(req);
427433
nvme_trace_bio_complete(req);
428434
if (req->cmd_flags & REQ_NVME_MPATH)
@@ -433,12 +439,6 @@ void nvme_end_req(struct request *req)
433439
{
434440
blk_status_t status = nvme_error_status(nvme_req(req)->status);
435441

436-
if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) {
437-
if (blk_rq_is_passthrough(req))
438-
nvme_log_err_passthru(req);
439-
else
440-
nvme_log_error(req);
441-
}
442442
__nvme_end_req(req);
443443
blk_mq_end_request(req, status);
444444
}

0 commit comments

Comments
 (0)