From: Luben Tuikov <tluben@rogers.com>
To: Mike Anderson <andmike@us.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>, linux-scsi@vger.kernel.org
Subject: Re: Patch: change the serial_number for error-handler commands
Date: Wed, 21 May 2003 14:50:57 -0400 [thread overview]
Message-ID: <3ECBCA91.9010106@rogers.com> (raw)
In-Reply-To: <20030521180308.GD1116@beaverton.ibm.com>
Mike Anderson wrote:
> Sorry for the slow response I was under the weather and not doing much
> yesterday.
>
> Alan Stern [stern@rowland.harvard.edu] wrote:
>
>>Well, the patch changes the serial number regardless of its initial value,
>>but otherwise yes. It would be okay with me to change scsi_core->sn.
>>But the global serial number is currently a static variable defined in
>>scsi.c and my change was to scsi_error.c -- I didn't want to export the
>>variable needlessly.
>>
>>
>>>Q: Which value does USB Storage reserve for cmdsn, 0 or MAX?
>>
>>It doesn't reserve any values. (I avoided 0 only because I noticed that
>>the scsi core uses 0 as a reserved value.) Usb-storage just requires that
>>serial numbers not be repeated.
>>
>
>
> I agree on the change in SCSI core instead of a change just for scsi
> error handling. If you are depending on command serial number to be
> unique as the comments in scsi_dispatch_cmd already indicate we have
> problems (in USB storage case since can_queue is 1 it would not run into a
> issue until scsi error handling).
>
> The patch below is a quick patch that moves the serial_number from a
> scsi mid level static to a per scsi host value. In looking at the usage
> of command serial_number it appears that moving to a per scsi host name
> space should be ok.
>
> I have compile and boot tested it on my system with the ips and aic7xxx
> drivers.
>
> The patch needs some more testing and some variable name updates, but
> should be ok to test USB and allow for discussion of this type of
> change.
1. cmdsn is per initiator, so I have no objections _in_principle_ to this
patch. (haven't looked at the patch code, just read the idea)
Actually cmdsn just insures delvery of the _command_ across
the interconnect, after that it doesn't matter. Normally transports play with
cmdsn, but it is no error for the application client to provide it. Transports
may ignore it completely, when they don't support it or when they generate
their own, and thus SCSI Core SHOULD NOT rely on this to identify the command.
2. SCSI Core->cmdsn should _always_ contain the _next_ cmdsn to be assigned.
This provides that at boot time, it contains 0, and this is consistent
with the fact that no commands have been issued yet. Assignment to a command
should be atomic a la, cmd->cmdsn = scsi_core->cmdsn++;
This also provides that for a reasonable value v [RFC1982],
one can tell immediately the number of commands issued, a la,
(scsi_core->cmdsn - v + MAX) % MAX is commands issued since v.
This is also consistent with the well known practice that indexes,
etc, always contain the _next_ index, so that that it serves as an index
(to the next) and as a _size_ variable just by reading it.
(#2 should probably be fixed first)
3. Zero is indeed a reserved value, as per SAM-3r07, 5.1.
4. The error handler is NO exception. If the error handler sends a
SCSI Command (i.e. a _CDB_) then it is supposed to assign a cmdsn,
as per the rules. This is for delivery.
--
Luben
next prev parent reply other threads:[~2003-05-21 18:38 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030516190414.GD11884@iucha.net>
2003-05-16 21:23 ` [linux-usb-devel] USB Storage oops in 2.5.69-bk8 Alan Stern
2003-05-16 21:44 ` Florin Iucha
2003-05-16 22:29 ` Mike Anderson
2003-05-17 15:29 ` Alan Stern
2003-05-17 16:33 ` David Brownell
2003-05-18 18:31 ` Alan Stern
2003-05-18 23:46 ` David Brownell
2003-05-21 15:19 ` Bug in hot-unplugging for SCSI CD-ROM Alan Stern
2003-05-17 18:38 ` [linux-usb-devel] USB Storage oops in 2.5.69-bk8 Patrick Mansfield
2003-05-31 14:35 ` Florin Iucha
2003-05-20 14:11 ` Patch: change the serial_number for error-handler commands Alan Stern
2003-05-20 21:25 ` Luben Tuikov
2003-05-21 1:19 ` Alan Stern
2003-05-21 18:03 ` Mike Anderson
2003-05-21 18:50 ` Luben Tuikov [this message]
2003-05-21 19:18 ` Luben Tuikov
2003-05-21 20:28 ` Mike Anderson
2003-05-21 21:11 ` Luben Tuikov
2003-05-21 23:15 ` Patrick Mansfield
2003-05-22 5:47 ` Luben Tuikov
2003-05-21 19:57 ` Alan Stern
2003-05-21 20:42 ` Luben Tuikov
2003-05-21 21:05 ` Alan Stern
2003-05-21 21:19 ` James Bottomley
2003-05-21 22:53 ` Mike Anderson
2003-06-11 17:41 ` PATCH: (as33) Remove /proc/scsi directory in scsi_remove_host() Alan Stern
2003-06-11 18:23 ` Mike Anderson
2003-06-12 6:04 ` Christoph Hellwig
2003-06-12 6:51 ` Mike Anderson
2003-06-12 21:00 ` PATCH: (as33b) " Alan Stern
2003-06-12 21:58 ` Mike Anderson
2003-06-13 14:38 ` Alan Stern
2003-06-15 13:01 ` Christoph Hellwig
2003-05-21 19:24 ` Patch: change the serial_number for error-handler commands Luben Tuikov
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=3ECBCA91.9010106@rogers.com \
--to=tluben@rogers.com \
--cc=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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