All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: core: Document the role of scsi_done()
@ 2026-10-15  0:05 Bart Van Assche
  2026-10-24  2:29 ` Martin K. Petersen
  2026-10-29  2:02 ` Martin K. Petersen (Oracle)
  0 siblings, 2 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-10-15  0:05 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, John Garry, Hannes Reinecke, Bart Van Assche

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>
---
 drivers/scsi/scsi_lib.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-29  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15  0:05 [PATCH] scsi: core: Document the role of scsi_done() Bart Van Assche
2026-10-24  2:29 ` Martin K. Petersen
2026-10-29  2:02 ` Martin K. Petersen (Oracle)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.