summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2026-10-14 17:05:10 -0700
committerMartin K. Petersen (Oracle) <mkp@kernel.org>2026-10-23 22:29:32 -0400
commitcfb7224381c90a50b36807bf3bfcfca730ed4fe2 (patch)
treed4e178b02a6e26b952cac1e56d36bdd7369ce0b5 /drivers
parent7cd44f40fe196df01afd93aba2f84a8a184a3baf (diff)
scsi: core: Document the role of scsi_done()
Document the role of scsi_done() and also how it deals with commands owned by the SCSI error handler. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/6edb00749da7a5ce9b7752d389ad2ed5a38776e4.1792022610.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/scsi_lib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f695a6605815..ab39514cc0c6 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1789,6 +1789,20 @@ static void scsi_done_internal(struct scsi_cmnd *cmd, bool complete_directly)
blk_mq_complete_request(req);
}
+/**
+ * scsi_done - Notify the SCSI mid-layer that a command has completed
+ * @cmd: Completed SCSI command
+ *
+ * Called by a SCSI low-level driver to notify the SCSI mid-layer that the
+ * command has completed. There are two cases:
+ *
+ * - The SCSI error handler does not own @cmd. In this case scsi_complete()
+ * decides how to complete the command based on the value of @cmd->result.
+ * - The SCSI error handler owns @cmd because scsi_timeout() has set
+ * SCMD_STATE_COMPLETE. In this case this function has no effect, @cmd->result
+ * is ignored and the SCSI error handler decides whether to retry or fail
+ * @cmd. See also scmd_eh_abort_handler() and scsi_eh_flush_done_q().
+ */
void scsi_done(struct scsi_cmnd *cmd)
{
scsi_done_internal(cmd, false);