public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <tluben@rogers.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: requeuing a Scsi_Cmnd?
Date: Mon, 12 May 2003 01:43:48 -0400	[thread overview]
Message-ID: <3EBF3494.6090100@rogers.com> (raw)
In-Reply-To: <3EBEB1D5.3040300@pobox.com>

Jeff Garzik wrote:
> 
> Suppose I am passed several Scsi_Cmnd structures via ->queuecommand. TCQ 
> depth is >1.  An event causes the entire queue to be aborted, but I know 
> that the majority of the queue was actually ok.

If the event was generated by the application client/SCSI Core,
then the normal logic applies -- either cancel all commands,
or cancel those which were not completed and finish those
which were.  I personally prefer the first option (unconditionally
cancel all commands on abort/clear task set) since this is what
the the spec says.

If the event was generated by other means, i.e. NOT by
the application client/SCSI Core, you can error out the
unfinished commands and return ok for the finished ones
(i.e. finish them).

>  So, my LLD would need 
> to requeue and resend most of the recently-aborted Scsi_Cmnds.
> 
> How do I tell the SCSI layer to requeue and resend a Scsi_Cmnd [almost] 
> immediately?

Return BUSY for the task(s) or TASK SET FULL for the task(s), which
you want to be requeued almost immediately.  There's a difference
between those two status codes as to their meaning, as per the spec.

In 2.4, if you return BUSY, the command is tried almost immediately,
and if you return TASK SET FULL, it is also tried but things
get too convoluted... so you're better off with BUSY.

In 2.5, BUSY and TASK SET FULL are treated the same, so you can
either go by the spec and return whichever makes sense, or
just return BUSY and you'll be fine for 2.4 and 2.5.

On a side note: remember that, as far as SCSI Transports
are concerned, after a task is cancelled (initiator sends
ABORT TASK to the TARGET) successfully, the target should
NOT send any status/response for that task, as the initiator
is NOT expecting ANY responses for a cancelled task
(across a transport, i.e. ``below'' a LLDD).

-- 
Luben




  reply	other threads:[~2003-05-12  5:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-11 20:25 requeuing a Scsi_Cmnd? Jeff Garzik
2003-05-12  5:43 ` Luben Tuikov [this message]
2003-05-12 14:44 ` James Bottomley
2003-05-12 18:12   ` Luben Tuikov
2003-05-12 20:30     ` James Bottomley
2003-05-13  0:20     ` Jeff Garzik
2003-10-30 23:48       ` Andre Hedrick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EBF3494.6090100@rogers.com \
    --to=tluben@rogers.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox