Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] SCSI: Introduce scsi_req_abort_cmd
@ 2006-01-27  5:22 Luben Tuikov
  2006-01-31 23:31 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Luben Tuikov @ 2006-01-27  5:22 UTC (permalink / raw)
  To: linux-scsi

Introduce scsi_req_abort_cmd(struct scsi_cmnd *).
This function requests that SCSI Core start recovery for the
command by deleting the timer and adding the command to the eh
queue.  It can be called by either LLDDs or SCSI Core.  LLDDs who
implement their own error recovery MAY ignore the timeout event if
they generated scsi_req_abort_cmd.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>

---

 drivers/scsi/scsi.c      |   18 ++++++++++++++++++
 include/scsi/scsi_cmnd.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

51df19a1669bd502b536178d6c294e68be25ce79
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 245ca99..1af9795 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -721,6 +721,24 @@ void scsi_init_cmd_from_req(struct scsi_
 static DEFINE_PER_CPU(struct list_head, scsi_done_q);
 
 /**
+ * scsi_req_abort_cmd -- Request command recovery for the specified command
+ * cmd: pointer to the SCSI command of interest
+ *
+ * This function requests that SCSI Core start recovery for the
+ * command by deleting the timer and adding the command to the eh
+ * queue.  It can be called by either LLDDs or SCSI Core.  LLDDs who
+ * implement their own error recovery MAY ignore the timeout event if
+ * they generated scsi_req_abort_cmd.
+ */
+void scsi_req_abort_cmd(struct scsi_cmnd *cmd)
+{
+	if (!scsi_delete_timer(cmd))
+		return;
+	scsi_times_out(cmd);
+}
+EXPORT_SYMBOL(scsi_req_abort_cmd);
+
+/**
  * scsi_done - Enqueue the finished SCSI command into the done queue.
  * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
  * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 7529f43..8b9ad8c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,5 +151,6 @@ extern struct scsi_cmnd *scsi_get_comman
 extern void scsi_put_command(struct scsi_cmnd *);
 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
 extern void scsi_finish_command(struct scsi_cmnd *cmd);
+extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
 
 #endif /* _SCSI_SCSI_CMND_H */
-- 
1.1.4.gb737


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

* Re: [PATCH] SCSI: Introduce scsi_req_abort_cmd
  2006-01-27  5:22 [PATCH] SCSI: Introduce scsi_req_abort_cmd Luben Tuikov
@ 2006-01-31 23:31 ` James Bottomley
  2006-02-01  3:39   ` Luben Tuikov
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2006-01-31 23:31 UTC (permalink / raw)
  To: ltuikov; +Cc: linux-scsi

On Thu, 2006-01-26 at 21:22 -0800, Luben Tuikov wrote:
> Introduce scsi_req_abort_cmd(struct scsi_cmnd *).
> This function requests that SCSI Core start recovery for the
> command by deleting the timer and adding the command to the eh
> queue.  It can be called by either LLDDs or SCSI Core.  LLDDs who
> implement their own error recovery MAY ignore the timeout event if
> they generated scsi_req_abort_cmd.

In theory, the code to do this already exists: the current way to
achieve this is supposed to be to return a status of DID_TIME_OUT to the
command, which triggers error recovery.  The only difference between
this and what you propose is that the eh_timed_out API won't get called
(presumably OK since the LLD already knows it wishes to trigger the
error handler) and that the error handler will begin at the device reset
task management function (again, on the assumption that the LLD cleaned
everything up before returning DID_TIME_OUT).  Is that sufficient for
your purpose or do we really need another API?

James





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

* Re: [PATCH] SCSI: Introduce scsi_req_abort_cmd
  2006-01-31 23:31 ` James Bottomley
@ 2006-02-01  3:39   ` Luben Tuikov
  0 siblings, 0 replies; 3+ messages in thread
From: Luben Tuikov @ 2006-02-01  3:39 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

--- James Bottomley <James.Bottomley@SteelEye.com> wrote:
> On Thu, 2006-01-26 at 21:22 -0800, Luben Tuikov wrote:
> > Introduce scsi_req_abort_cmd(struct scsi_cmnd *).
> > This function requests that SCSI Core start recovery for the
> > command by deleting the timer and adding the command to the eh
> > queue.  It can be called by either LLDDs or SCSI Core.  LLDDs who
> > implement their own error recovery MAY ignore the timeout event if
> > they generated scsi_req_abort_cmd.
> 
> In theory, the code to do this already exists: the current way to
> achieve this is supposed to be to return a status of DID_TIME_OUT to the
> command, which triggers error recovery.  The only difference between
> this and what you propose is that the eh_timed_out API won't get called
> (presumably OK since the LLD already knows it wishes to trigger the
> error handler) and that the error handler will begin at the device reset
> task management function (again, on the assumption that the LLD cleaned
> everything up before returning DID_TIME_OUT).  Is that sufficient for
> your purpose or do we really need another API?

No, it is not sufficient.
Yes, you really do need another API.

   Luben


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

end of thread, other threads:[~2006-02-01  3:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-27  5:22 [PATCH] SCSI: Introduce scsi_req_abort_cmd Luben Tuikov
2006-01-31 23:31 ` James Bottomley
2006-02-01  3:39   ` Luben Tuikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox