]> bbs.cooldavid.org Git - net-next-2.6.git/log
net-next-2.6.git
18 years ago[SCSI] fix up request buffer reference in various scsi drivers
Christoph Hellwig [Sat, 3 Jun 2006 11:21:13 +0000 (13:21 +0200)]
[SCSI] fix up request buffer reference in various scsi drivers

Various scsi drivers use scsi_cmnd.buffer and scsi_cmnd.bufflen in their
queuecommand functions.  Those fields are internal storage for the
midlayer only and are used to restore the original payload after
request_buffer and request_bufflen have been overwritten for EH.  Using
the buffer and bufflen fields means they do very broken things in error
handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] megaraid_sas: switch fw_outstanding to an atomic_t
Sumant Patro [Tue, 30 May 2006 19:03:37 +0000 (12:03 -0700)]
[SCSI] megaraid_sas: switch fw_outstanding to an atomic_t

This patch( originally submitted by Christoph Hellwig) removes
instance_lock and changes fw_outstanding variable data type to
atomic_t.

Signed-off-by: Sumant Patro <Sumant.Patro@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: update version to 1.0-595
Mike Christie [Tue, 30 May 2006 06:04:51 +0000 (01:04 -0500)]
[SCSI] iscsi: update version to 1.0-595

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: fix writepsace race
Mike Christie [Tue, 30 May 2006 05:37:28 +0000 (00:37 -0500)]
[SCSI] iscsi: fix writepsace race

We can race and misset the suspend bit if iscsi_write_space is
called then iscsi_send returns with a failure indicating
there is no space.

To handle this this patch returns a error upwards allowing xmitworker
to decide if we need to try and transmit again. For the no
write space case xmitworker will not retry, and instead
let iscsi_write_space queue it back up if needed (this relies
on the work queue code to properly requeue us if needed).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: return task found during search
Mike Christie [Tue, 30 May 2006 05:37:25 +0000 (00:37 -0500)]
[SCSI] iscsi: return task found during search

from davidw@netapp.com:

remove task type should return a task on success.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: fix run list corruption
Mike Christie [Tue, 30 May 2006 05:37:22 +0000 (00:37 -0500)]
[SCSI] iscsi: fix run list corruption

from davidw@netapp.com:

We must grab the session lock when modifying the running lists.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: don't switch states when just cleaning up
Mike Christie [Tue, 30 May 2006 05:37:20 +0000 (00:37 -0500)]
[SCSI] iscsi: don't switch states when just cleaning up

If recovery failed or we are in recovery only overwrite the state
if we are going to terminate the session or if we logged back in.

STOP_CONN_SUSPEND and conn_cnt are not used. We only support
a single connection session ATM, so cleanup that code while
we are working around it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] kdump: mpt fusion driver initialization failure fix
Vivek Goyal [Thu, 27 Apr 2006 09:33:13 +0000 (02:33 -0700)]
[SCSI] kdump: mpt fusion driver initialization failure fix

MPT fusion driver initialization fails while second kernel is booting,
after a system crash (if kdump kernel is configured).  Oops message is
pasted below.

*****************************************************************************
Fusion MPT base driver 3.03.08
Copyright (c) 1999-2005 LSI Logic Corporation
Fusion MPT SAS Host driver 3.03.08 ACPI: PCI Interrupt 0000:01:00.0[A] -> Link [LNKA] -> GSI 5 (level, low) -> IRQ 5
mptbase: Initiating ioc0 bringup
BUG: unable to handle kernel paging request at virtual address 00002608
 printing eip:
c11782fd
*pde = 00000000
Oops: 0000 [#1]
Modules linked in:
CPU:    0
EIP:    0060:[<c11782fd>]    Not tainted VLI
EFLAGS: 00010046   (2.6.17-rc1-16M #2)
EIP is at mptscsih_io_done+0x27/0x3a3
eax: c4fed000   ebx: c4fed000   ecx: 00002600   edx: 00000298
esi: c11782d6   edi: 00002600   ebp: 00000000   esp: c1332f74
ds: 007b   es: 007b   ss: 0068
Process swapper (pid: 0, threadinfo=c1332000 task=c128f9c0) Stack: <0>0000006c 00000020 00000298 00002600 c4fed000 c4fed000 c11782d6 0000260 0
       00000000 c1172c49 c4fed000 c1305b40 00000005 00000000 c1172d75 c48877e0
       c1029687 00000000 c1307fb8 00000000 c1305a00 00000001 00000000 c1307fb8
Call Trace:
 <c11782d6> mptscsih_io_done+0x0/0x3a3   <c1172c49> mpt_turbo_reply+0xbb/0xd3
 <c1172d75> mpt_interrupt+0x22/0x2b   <c1029687> misrouted_irq+0x63/0xcb
 <c10297b3> note_interrupt+0x43/0x98   <c10292f9> __do_IRQ+0x68/0x8f
 <c1003fac> do_IRQ+0x36/0x4e
 =======================
 <c1002aa6> common_interrupt+0x1a/0x20   <c1001150> mwait_idle+0x1a/0x2a
 <c10010bf> cpu_idle+0x40/0x5c   <c1308610> start_kernel+0x17a/0x17c Code: 5e 5f 5d c3 55 89 cd 57 56 53 83 ec 14 89 54 24 0c 89 44 24 10 8b 90 cc 00  00 00 8b 4c 24 0c 81 c2 98 02 00 00 85 ed 89 54 24 08 <0f> b7 79 08 89 fe 74 04  0f b7 75 08 66 39 f7 75 0d 8b 44 24 0c
*******************************************************************************

o Kdump capture kernel boot fails during initialization of MPT fusion driver.
  (LSI Logic / Symbios Logic SAS1064E PCI-Express Fusion-MPT SAS (rev 01))

o Problem is easily reproducible, if system crashed while some disk activity
  like cp operation was going on.

o After a system crash, devices are not shutdown and capture kernel starts
  booting while skipping BIOS. Hence underlying device is left in operational
  state. In this case scsi contoller was left with interrupt line asserted
  reply FIFO was not empty. When driver starts initializing in the second
  kernel, it receives the interrupt the moment request_irq() is called.
  Interrupt handler, reads the message from reply FIFO and tries to access
  the associated message frame and panics, as in the new kernel's context
  that message frame is not valid at all.

o In this scenario, probably we should delay the request_irq() call. First
  bring up the IOC, reset it if needed and then should register for irq.

o I have tested the patch with SAS1064E and 53c1030 controllers.

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: "Moore, Eric Dean" <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] audit drivers for incorrect max_id use
Hannes Reinecke [Tue, 23 May 2006 08:29:28 +0000 (10:29 +0200)]
[SCSI] audit drivers for incorrect max_id use

max_id now means the maximum number of ids on the bus, which means it
is one greater than the largest possible id number.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Return -EINVAL when "id == max_id" in scsi_scan_host_selected()
Amit Arora [Fri, 19 May 2006 23:14:50 +0000 (16:14 -0700)]
[SCSI] Return -EINVAL when "id == max_id" in scsi_scan_host_selected()

The scsi_scan_host_selected() should return -EINVAL when the id is equal
to the max_id. Currently it uses ">" when comparing with max_id, and
hence leaves the border case when "id==max_id".
The channel and lun have values valid from 0 up to,
and including, max_channel or max_lun. But, the valid values for id
range from 0 to max_id-1. This patch fixes the problem.

Signed-off-by: Amit Arora <aarora@in.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: bump up version number
Andreas Herrmann [Mon, 22 May 2006 16:27:30 +0000 (18:27 +0200)]
[SCSI] zfcp: bump up version number

Bump up version number, skip "4.6.0" because this might
clash with zfcp version in certain distros.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: make use of fc_remote_port_delete when target port is unavailable
Andreas Herrmann [Mon, 22 May 2006 16:25:56 +0000 (18:25 +0200)]
[SCSI] zfcp: make use of fc_remote_port_delete when target port is unavailable

If zfcp's port erp fails we now call fc_remote_port_delete. This helps
to avoid offlined scsi devices if scsi commands time out due to path
failures. When an adapter erp fails we call fc_remote_port_delete for
all ports on that adapter.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: evaluate plogi payload to set maxframe_size, supported_classes of rports
Ralph Wuerthner [Mon, 22 May 2006 16:24:33 +0000 (18:24 +0200)]
[SCSI] zfcp: evaluate plogi payload to set maxframe_size, supported_classes of rports

Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com>
Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: print bit error threshold data human readable
Ralph Wuerthner [Mon, 22 May 2006 16:21:28 +0000 (18:21 +0200)]
[SCSI] zfcp: print bit error threshold data human readable

Replace hex dump of bit error threshold data by log message showing
bit error threshold data human readable.

Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com>
Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: (cleanup) removed superfluous macros, struct members, typedefs
Andreas Herrmann [Mon, 22 May 2006 16:18:19 +0000 (18:18 +0200)]
[SCSI] zfcp: (cleanup) removed superfluous macros, struct members, typedefs

Removed some macros, struct members and typedefs which were
unused or not necessary.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: (cleanup) kmalloc/kzalloc replacement
Andreas Herrmann [Mon, 22 May 2006 16:17:30 +0000 (18:17 +0200)]
[SCSI] zfcp: (cleanup) kmalloc/kzalloc replacement

Replace kmalloc/memset by kzalloc or kcalloc.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: (cleanup) remove useless comments
Andreas Herrmann [Mon, 22 May 2006 16:15:49 +0000 (18:15 +0200)]
[SCSI] zfcp: (cleanup) remove useless comments

Removed some useless comments.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] zfcp: (cleanup) shortened copyright and author information
Andreas Herrmann [Mon, 22 May 2006 16:14:08 +0000 (18:14 +0200)]
[SCSI] zfcp: (cleanup) shortened copyright and author information

Copyright update, shortened file headers, shortened author information.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] imm: no need for unchecked_isa_dma
Randy Dunlap [Fri, 19 May 2006 18:55:58 +0000 (11:55 -0700)]
[SCSI] imm: no need for unchecked_isa_dma

Relax the lowmem bounce buffer requirement for imm so that any
low memory page will do -- they don't need to be below the
ISA 16 MB limit, just need to be mapped in low memory.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Update version number to 8.01.05-k2.
Andrew Vasquez [Wed, 17 May 2006 22:10:01 +0000 (15:10 -0700)]
[SCSI] qla2xxx: Update version number to 8.01.05-k2.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Correct issue where driver improperly issued SNS commands in N2N...
Andrew Vasquez [Wed, 17 May 2006 22:09:56 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Correct issue where driver improperly issued SNS commands in N2N topologies.

Semantic changes in ISP24xx firmware behaviour inadvertently
caused the driver to believe an F-port topology was present in an
N_port-to-N_port configuration.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Consolidate firmware-dump handling across ISPs.
Andrew Vasquez [Wed, 17 May 2006 22:09:50 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Consolidate firmware-dump handling across ISPs.

Simplify and centralise buffer allocation/deallocation, as
there's no point in having two memory request methods.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Consolidate "qla2xxx" string usage to a #define.
Andrew Vasquez [Wed, 17 May 2006 22:09:45 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Consolidate "qla2xxx" string usage to a #define.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Use PCI_DEVICE() for pci_device_id definition.
Andrew Vasquez [Wed, 17 May 2006 22:09:39 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Use PCI_DEVICE() for pci_device_id definition.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Remove obsolete firmware-loader-module support.
Andrew Vasquez [Wed, 17 May 2006 22:09:34 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Remove obsolete firmware-loader-module support.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Remove unused port-type RSCN handling code.
Andrew Vasquez [Wed, 17 May 2006 22:09:27 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Remove unused port-type RSCN handling code.

Expandind on the previous commit:

commit 79f89a4296ff22f09baf538d4ff2a6d0c3097a73
Author: andrew.vasquez@qlogic.com <andrew.vasquez@qlogic.com>
Date:   Fri Jan 13 17:05:58 2006 -0800

[SCSI] qla2xxx: Disable port-type RSCN handling via driver state-machine.

and given:

- the process-context requirements of the FC transport
  rport-APIs.
- lack of port-type RSCN processing logic for ISP24xx and newer
  chips.

it's time now to remove the state-machine logic from mainline.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Drop unused driver cruft.
Andrew Vasquez [Wed, 17 May 2006 22:09:22 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Drop unused driver cruft.

- structure definitions.
- structure members.
- #define's.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Add support for alternate WWN NVRAM setting.
Andrew Vasquez [Wed, 17 May 2006 22:09:16 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Add support for alternate WWN NVRAM setting.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Correct endianess comparisons during ISP24xx NVRAM configuration.
Andrew Vasquez [Wed, 17 May 2006 22:09:11 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Correct endianess comparisons during ISP24xx NVRAM configuration.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: ABBA lock ordering fix.
Andrew Vasquez [Wed, 17 May 2006 22:09:06 +0000 (15:09 -0700)]
[SCSI] qla2xxx: ABBA lock ordering fix.

In qla2x00_reset_chip the driver first takes the hardware lock,
and then later on takes the mbx lock.

In the mailbox_command code.. it goes the other way around.

Discovered with the lock validator.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Update ISP24xx firwmare loading heuristics.
Andrew Vasquez [Wed, 17 May 2006 22:09:00 +0000 (15:09 -0700)]
[SCSI] qla2xxx: Update ISP24xx firwmare loading heuristics.

If firmware image is unavailable via request_firwmare(), then
attempt to load the image (likely out-of-date) stored in flash
memory.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Use FW calculated residual count for underrun handling.
Ravi Anand [Wed, 17 May 2006 22:08:55 +0000 (15:08 -0700)]
[SCSI] qla2xxx: Use FW calculated residual count for underrun handling.

With ISP24XX and ISP54XX parts.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Add support for new flash part.
Ravi Anand [Wed, 17 May 2006 22:08:49 +0000 (15:08 -0700)]
[SCSI] qla2xxx: Add support for new flash part.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] qla2xxx: Don't wait for loop transition to complete if LOOP_DEAD state is...
Ravi Anand [Wed, 17 May 2006 22:08:44 +0000 (15:08 -0700)]
[SCSI] qla2xxx: Don't wait for loop transition to complete if LOOP_DEAD state is attained.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: update version
Mike Christie [Fri, 19 May 2006 01:31:43 +0000 (20:31 -0500)]
[SCSI] iscsi: update version

update version

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: fix command requeues during iscsi recovery
Mike Christie [Fri, 19 May 2006 01:31:42 +0000 (20:31 -0500)]
[SCSI] iscsi: fix command requeues during iscsi recovery

Do not flush queues then block session. This will cause commands
to needlessly swing around on us and remove goofy
recovery_failed field and replace with state value.

And do not start recovery from within the host reset function.
This causeis too many problems becuase open-iscsi was desinged to
call out to userspace then have userpscae decide if we should
go into recovery or kill the session.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: support mutiple daemons
Mike Christie [Fri, 19 May 2006 01:31:39 +0000 (20:31 -0500)]
[SCSI] iscsi: support mutiple daemons

Patch from david.somayajulu@qlogic.com and cleaned up by Tomo.

qla4xxx is going to have a different daemon so this patch
just routes the events to the right daemon.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: kill dtask mempools
Mike Christie [Fri, 19 May 2006 01:31:36 +0000 (20:31 -0500)]
[SCSI] iscsi: kill dtask mempools

Discovered by steven@hayter.me.uk and patch by michaelc@cs.wisc.edu

The dtask mempool is reserving 261120 items per session! Since we are now
sending headers with sendmsg there is no reason for the mempool and that
was causing us to us carzy amounts of mem. We can preallicate a header in
the r2t and task struct and reuse them

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: only preallocate login buffer
Mike Christie [Fri, 19 May 2006 01:31:34 +0000 (20:31 -0500)]
[SCSI] iscsi: only preallocate login buffer

We only use the mtask data buffer for login tasks so we do not
need to preallocate a buffer for every mtask. This saves
8 * 31 KB.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: dont use sendpage for iscsi headers
Mike Christie [Fri, 19 May 2006 01:31:31 +0000 (20:31 -0500)]
[SCSI] iscsi: dont use sendpage for iscsi headers

From Zhen and ported by Mike:

Don't use sendpage for the headers. sendpage for the pdu headers
does not seem to have a performance impact, makes life harder
for mutiple data pdus to be in flight and still trips up some
network cards when it is from slab mem.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] fix (unlikely) memory leak in DAC960 driver
Jesper Juhl [Sat, 13 May 2006 22:39:38 +0000 (00:39 +0200)]
[SCSI] fix (unlikely) memory leak in DAC960 driver

The Coverity checker found a memory leak (bug nr. 1245) in
 drivers/block/DAC960.c::DAC960_V2_ProcessCompletedCommand()

The leak is pretty unlikely since it requires that the first of two
successive kmalloc() calls fail while the second one succeeds. But it can
still happen even if it's unlikely.

If the first call that allocates 'PhysicalDeviceInfo' fails but the one
that allocates 'InquiryUnitSerialNumber' succeeds, then we will leak the
memory allocated to 'InquiryUnitSerialNumber' when the variable goes out
of scope.

A simple fix for this is to change the existing code that frees
'PhysicalDeviceInfo' if that one was allocated but
'InquiryUnitSerialNumber' was not, into a check for either pointer
being NULL and if so just free both. This is safe since kfree() can
deal with being passed a NULL pointer and it avoids the leak.

While I was there I also removed the casts of the kmalloc() return
value since it's pointless.
I also updated the driver version since this patch changes the workings of
the code (however slightly).

This issue could probably be fixed a lot more elegantly, but the code
is a big mess IMHO and I just took the least intrusive route to a fix
that I could find instead of starting on a cleanup as well (that can
come later).

Please consider for inclusion.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: remove unneeded list
Mark Haverkamp [Wed, 10 May 2006 16:13:37 +0000 (09:13 -0700)]
[SCSI] aacraid: remove unneeded list

Received From Mark Salyzyn

The queue tracking is just not being used, not even for debugging. Information
about outstanding commands can be acquired from the scsi structures.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: sa race condition fix
Mark Haverkamp [Wed, 10 May 2006 16:13:11 +0000 (09:13 -0700)]
[SCSI] aacraid: sa race condition fix

Received From Mark Salyzyn

A race condition existed that could result in a lost completion of a
command to the ppc based cards.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: adjustable timeouts
Mark Haverkamp [Wed, 10 May 2006 16:12:48 +0000 (09:12 -0700)]
[SCSI] aacraid: adjustable timeouts

Received From Mark Salyzyn

Add the ability to adjust for unusual corner case failures. Both of
these additional module parameters deal with embedded, non-intel or
complicated system scenarios.

Aif_timeout can be increased past the default 2 minute timeout to drop
application registrations when a system has an unusually high event load
resulting from continuing management requests, or simultaneous builds,
or sluggish user space as a result of system load.

Startup_timeout can be increased past the default 3 minute timeout to
drop an adapter initialization for systems that have a very large number
of targets, or slow to spin-up targets, or a complicated set of array
configurations that extend the time for the firmware to declare that it
is operational. This timeout would only have an affect on non-intel
based systems, as the (more patient) BIOS would generally be where the
startup delay would be dealt with.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: optimize sg alloc
Mark Haverkamp [Wed, 10 May 2006 16:12:05 +0000 (09:12 -0700)]
[SCSI] aacraid: optimize sg alloc

Received From Mark Salyzyn

Slight space and speed efficiency improvement.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: remove unneeded locking
Mark Haverkamp [Wed, 10 May 2006 16:11:38 +0000 (09:11 -0700)]
[SCSI] aacraid: remove unneeded locking

Received From Mark Salyzyn

Since new commands to the card are quiesced, respect the changes in
the SCSI error path which dropped locking around the hba reset handler
and similarly drop the lock requirement in the driver's path.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] fix proc_scsi_write to return "length" on success with remove-single-device...
James Bottomley [Thu, 27 Apr 2006 19:07:49 +0000 (14:07 -0500)]
[SCSI] fix proc_scsi_write to return "length" on success with remove-single-device case

Problem spotted by: Suzuki K P <suzuki@in.ibm.com>

A zero return on success isn't correct for filesystem write functions.
They should either return negative error or the length of bytes
consumed.  Add code to convert our zero on success error return to
return the length of bytes passed in.

This fixes the following:

$ echo "scsi remove-single-device 0 0 3 0" > /proc/scsi/scsi
bash: echo: write error: No such device or address"

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: dequeue all buffers from queue
Mike Christie [Wed, 3 May 2006 00:46:49 +0000 (19:46 -0500)]
[SCSI] iscsi: dequeue all buffers from queue

debugged by wrwhitehead@novell.com
patch and analysis by fujita.tomonori@lab.ntt.co.jp

Only tcp_read_sock and recv_actor (iscsi_tcp_data_recv for us) see
desc.count. It is is used just for permitting tcp_read_sock to read
the portion of data in the socket.

When iscsi_tcp_data_recv sees a partial header, it sets
desc.count. However, it is possible that the next skb (containing the
rest of the header) still does not come. So I'm not sure that this
scheme is completely correct.

Ideally, we should use the exact length of the data in the socket for
desc.count. However, it is not so simple (see SIOCINQ in
tcp_ioctl). So I think that iscsi_tcp_data_recv can just stop playing
with desc.count and tell tcp_read_sock to read the all skbs. As
proposed already, if iscsi_tcp_data_ready sets desc.count to
non-zero, tcp_read_sock does that.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: increment expstatsn during login
Mike Christie [Wed, 3 May 2006 00:46:47 +0000 (19:46 -0500)]
[SCSI] iscsi: increment expstatsn during login

debugged by Ming and Rohan:

The problem Ming and Rohan debugged was that during a normal session
login, open-iscsi is not incrementing the exp_statsn counter. It was
stuck at zero. From the RFC, it looks like if the login response PDU has
a successful status then we should be incrementing that value. Also from
the RFC, it looks like if when we drop a connection then reconnect, we
should be using the exp_statsn from the old connection in the next
relogin attempt.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: align printks
Or Gerlitz [Wed, 3 May 2006 00:46:43 +0000 (19:46 -0500)]
[SCSI] iscsi: align printks

align printk output

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: fix manamgement task oops
Mike Christie [Wed, 3 May 2006 00:46:40 +0000 (19:46 -0500)]
[SCSI] iscsi: fix manamgement task oops

from patmans@us.ibm.com and michaelc@cs.wisc.edu

Fix bugs when forcing a mgmt task to fail and allow
session recovery to cleanup the session/connection
of any running mgmt tasks. When called during
the in login state.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: add transport end point callbacks
Or Gerlitz [Wed, 3 May 2006 00:46:36 +0000 (19:46 -0500)]
[SCSI] iscsi: add transport end point callbacks

add transport end point callbacks so iscsi drivers that cannot connect
from userspace, like iscsi tcp, using sockets do not have to
implement their own socket infrastructure.

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] scsi_lib.c: fix warning in scsi_kmap_atomic_sg
Andrew Morton [Wed, 19 Apr 2006 04:09:08 +0000 (21:09 -0700)]
[SCSI] scsi_lib.c: fix warning in scsi_kmap_atomic_sg

drivers/scsi/scsi_lib.c: In function `scsi_kmap_atomic_sg':
drivers/scsi/scsi_lib.c:2394: warning: unsigned int format, different type arg (arg 3)
drivers/scsi/scsi_lib.c:2394: warning: unsigned int format, different type arg (arg 4)

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] scsi_scan.c: fix compile warnings
akpm@osdl.org [Sat, 15 Apr 2006 07:30:24 +0000 (00:30 -0700)]
[SCSI] scsi_scan.c: fix compile warnings

drivers/scsi/scsi_scan.c: In function `scsi_probe_and_add_lun':
drivers/scsi/scsi_scan.c:926: warning: unused variable `vend'
drivers/scsi/scsi_scan.c:926: warning: unused variable `mod'
drivers/scsi/scsi_scan.c: At top level:
drivers/scsi/scsi_scan.c:829: warning: `scsi_inq_str' defined but not used

Fix those, tighten up the (somewhat poorly-designed) logging macro and fix
some coding-style warts.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] dc395x: dynamically map scatter-gather for PIO
Guennadi Liakhovetski [Sun, 2 Apr 2006 19:57:43 +0000 (21:57 +0200)]
[SCSI] dc395x: dynamically map scatter-gather for PIO

The current dc395x driver uses PIO to transfer up to 4 bytes which do not
get transferred by DMA (under unclear circumstances). For this the driver
uses page_address() which is broken on highmem. Apart from this the
actual calculation of the virtual address is wrong (even without highmem).
So, e.g., for reading it reads bytes from the driver to a wrong address
and returns wrong data, I guess, for writing it would just output random
data to the device.

The proper fix, as suggested by many, is to dynamically map data using
kmap_atomic(page, KM_BIO_SRC_IRQ) / kunmap_atomic(virt). The reason why it
has not been done until now, although I've done some preliminary patches
more than a year ago was that nobody interested in fixing this problem was
able to reliably reproduce it. Now it changed - with the help from
Sebastian Frei (CC'ed) I was able to trigger the PIO path. Thus, I was
also able to test and debug it.

There are 4 cases when PIO is used in dc395x - data-in / -out with and
without scatter-gather. I was able to reproduce and test only data-in with
and without SG. So, the data-out path is still untested, but it is also
somewhat simpler than the data-in. Fredrik Roubert (also CC'ed) also had
PIO triggering on his system, and in his case it was data-out without SG.
It would be great if he could test the attached patch on his system, but
even if he cannot, I would still request to apply the patch and just wait
if anybody cries...

Implementation: I put 2 new functions in scsi_lib.c and their declarations
in scsi_cmnd.h. I exported them without _GPL, although, I don't feel
strongly about that - not many drivers are likely to use them. But there
is at least one more - I want to use them in tmscsim.c. Whether these are
the right files for the functions and their declarations - not sure
either. Actually, they are not scsi-specific, so, might go somewhere
around other scattergather magic? They are not platform specific either,
and most SG functions are defined under arch/*/... As these issues were
discussed previously there were some more routines suggested to manipulate
scattergather buffers, I think, some of them were needed around
crypto code... So, might be a common place reasonable, like
lib/scattergather.c? I am open here.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ibmvscsi: convert kmalloc + memset to kcalloc
FUJITA Tomonori [Fri, 7 Apr 2006 10:10:03 +0000 (19:10 +0900)]
[SCSI] ibmvscsi: convert kmalloc + memset to kcalloc

Convert kmalloc + memset to kcalloc in ibmvscsi

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Dave Boutcher <sleddog@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years agoMerge ../scsi-rc-fixes-2.6
James Bottomley [Fri, 14 Apr 2006 20:47:45 +0000 (15:47 -0500)]
Merge ../scsi-rc-fixes-2.6

Conflicts:

include/scsi/scsi_devinfo.h

Same number for two BLIST flags:  BLIST_MAX_512 and BLIST_ATTACH_PQ3

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] scsi_transport_sas: don't scan a non-existent end device
James Bottomley [Fri, 14 Apr 2006 14:47:59 +0000 (09:47 -0500)]
[SCSI] scsi_transport_sas: don't scan a non-existent end device

Any end device that can't support any of the scanning protocols
shouldn't be scanned, so set its id to -1 to prevent
scsi_scan_target() being called for it.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: convert iscsi tcp to libiscsi
Mike Christie [Fri, 7 Apr 2006 02:26:46 +0000 (21:26 -0500)]
[SCSI] iscsi: convert iscsi tcp to libiscsi

This just converts iscsi_tcp to the lib

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: add libiscsi
Mike Christie [Fri, 7 Apr 2006 02:13:41 +0000 (21:13 -0500)]
[SCSI] iscsi: add libiscsi

There is a lot of code duplcited between iscsi_tcp
and the upcoming iscsi_iser driver. This patch puts
the duplicated code in a lib. There is more code
to move around but this takes care of the
basics. For iscsi_offload if they use the lib we will
probably move some things around. For example in the
queuecommand we will not assume that the LLD wants
to do queue_work, but it is better to handle that
later when we know for sure what iscsi_offload looks
like (we could probably do this for iscsi_iser though to).

Ideally I would like to get the iscsi_transports modules
to a place where all they really have to do is put data
on the wire, but how to do that will hopefully be more clear
when we see other modules like iscsi_offload. Or maybe
iscsi_offload will not use the lib and it will just be
iscsi_iser and iscsi_tcp and maybe the iscsi_tcp_tgt if that
is allowed in mainline.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: fix up iscsi eh
Mike Christie [Fri, 7 Apr 2006 02:13:39 +0000 (21:13 -0500)]
[SCSI] iscsi: fix up iscsi eh

The current iscsi_tcp eh is not nicely setup for dm-multipath
and performs some extra task management functions when they
are not needed.

The attached patch:

- Fixes the TMF issues. If a session is rebuilt
then we do not send aborts.

- Fixes the problem where if the host reset fired, we would
return SUCCESS even though we had not really done anything
yet. This ends up causing problem with scsi_error.c's TUR.

- If someone has turned on the userspace nop daemon code to try
and detect network problems before the scsi command timeout
we can now drop and clean up the session before the scsi command
timesout and fires the eh speeding up the time it takes for a
command to go from one patch to another. For network problems
we fail the command with DID_BUS_BUSY so if failfast is set
scsi_decide_disposition fails the command up to dm for it to
try on another path.

- And we had to add some basic iscsi session block code. Previously
if we were trying to repair a session we would retrun a MLQUEUE code
in the queuecommand. This worked but it was not the most efficient
or pretty thing to do since it would take a while to relogin
to the target. For iscsi_tcp/open-iscsi a lot of the iscsi error handler
is in userspace the block code is pretty bare. We will be
adding to that for qla4xxx.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: add sysfs attrs for uspace sync up
Mike Christie [Fri, 7 Apr 2006 02:13:36 +0000 (21:13 -0500)]
[SCSI] iscsi: add sysfs attrs for uspace sync up

For iscsi boot when going from initramfs to the real root we
need to stop the userpsace iscsi daemon. To later restart it
iscsid needs to be able to rebuild itself and part of that
process is matching a session running the kernel with the
iscsid representation. To do this the attached patch
adds several required iscsi values. If the LLD does not provide
them becuase, login is done in userspace, then the transport
class and userspace set ths up for the LLD.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] iscsi: rm kernel iscsi handles usage for session and connection
Mike Christie [Fri, 7 Apr 2006 02:13:33 +0000 (21:13 -0500)]
[SCSI] iscsi: rm kernel iscsi handles usage for session and connection

from hare@suse.de and michaelc@cs.wisc.edu

hw iscsi like qla4xxx does not allocate a host per session and
for userspace it is difficult to restart iscsid using the
"iscsi handles" for the session and connection, so this
patch just has the class or userspace allocate the id for
the session and connection.

Note: this breaks userspace and requires users to upgrade to the newest
open-iscsi tools. Sorry about his but open-iscsi is still too new to
say we have a stable user-kernel api and we were not good nough
designers to know that other hw iscsi drivers and iscsid itself would
need such changes. Actually we sorta did but at the time we did not
have the HW available to us so we could only guess.

Luckily, the only tools hooking into the class are the open-iscsi ones
or other tools like iscsitart hook into the open-iscsi engine from
userspace or prgroams like anaconda call our tools so they are not affected.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] BLIST_ATTACH_PQ3 flags
Kurt Garloff [Mon, 3 Apr 2006 13:20:08 +0000 (15:20 +0200)]
[SCSI] BLIST_ATTACH_PQ3 flags

Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.

Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.

This is patch 3/3:
3. Implement the blacklist flag BLIST_ATTACH_PQ3 that makes the scsi
   scanning code register PQ3 devices and continues scanning; only sg
   will attach thanks to scsi_bus_match().

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Better log messages for PQ3 devs
Kurt Garloff [Mon, 3 Apr 2006 13:18:35 +0000 (15:18 +0200)]
[SCSI] Better log messages for PQ3 devs

Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.

Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.

This patch 2/3:
If a PQ3 device is found, log a message that describes the device
(INQUIRY DATA and C:B:T:U tuple) and make a suggestion for blacklisting
it.

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Try LUN 1 and use bflags
Kurt Garloff [Mon, 3 Apr 2006 13:16:48 +0000 (15:16 +0200)]
[SCSI] Try LUN 1 and use bflags

Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.

Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.

This is patch 1/3:
If we end up in sequential scan, at least try LUN 1 for devices
that reported a PQ of 3 for LUN 0.
Also return blacklist flags, even for PQ3 devices.

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] mptfusion - fix panic in mptsas_slave_configure
Moore, Eric [Thu, 13 Apr 2006 22:08:17 +0000 (16:08 -0600)]
[SCSI] mptfusion - fix panic in mptsas_slave_configure

Driver panic when RAID logical volume was present when driver
loaded, or when a RAID logical volume was created on the fly.

This issue was created in due to recent scsi_transport_sas change,
when sas_read_port_mode_page was added into the mptsas drivers
slave_config entry point.

This new API expects that all sdev's to be assocated to an rphy, however
that is not the case for logical volumes, as they are created using
scsi_add_device, instead of sas_rphy_add().

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] 3ware 9000 disable local irqs during kmap_atomic
adam radford [Tue, 11 Apr 2006 18:25:09 +0000 (11:25 -0700)]
[SCSI] 3ware 9000 disable local irqs during kmap_atomic

Equivalent of the same patch for the 3w-xxxx driver.

Signed-off-by: Adam Radford <linuxraid@amcc.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] SCSI: fix scsi_kill_request() busy count handling
Tejun Heo [Tue, 11 Apr 2006 08:27:53 +0000 (17:27 +0900)]
[SCSI] SCSI: fix scsi_kill_request() busy count handling

scsi_kill_request() completes requests via normal SCSI completion path
which decrements busy counts; however, requests which get passed to
scsi_kill_request() aren't holding busy counts and scsi_kill_request()
don't increment them before invoking completion path resulting in
incorrect busy counts.  Bump up busy counts before invoking completion
path.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] FC transport: fixes for workq deadlocks
James Smart [Mon, 10 Apr 2006 14:14:05 +0000 (10:14 -0400)]
[SCSI] FC transport: fixes for workq deadlocks

As previously reported via Michael Reed, the FC transport took a hit
in 2.6.15 (perhaps a little earlier) when we solved a recursion error.
There are 2 deadlocks occurring:
- With scan and the delete items sharing the same workq, flushing the
  workq for the delete code was getting it stalled behind a very long
  running scan code path.
- There's a deadlock where scsi_remove_target() has to sit behind
  scsi_scan_target() due to contention over the scan_lock().

This patch resolves the 1st deadlock and significantly reduces the
odds of the second. So far, we have only replicated the 2nd deadlock
on a highly-parallel SMP system. More on the 2nd deadlock in a following
email.

This patch reworks the transport to:
- Only use the scsi host workq for scanning
- Use 2 other workq's internally. One for deletions, the other for
  scheduled deletions. Originally, we tried this with a single workq,
  but the occassional flushes of the scheduled queues was hitting the
  second deadlock with a slightly higher frequency. In the future, we'll
  look at the LLDD's and the transport to see if we can get rid of this
  extra overhead.
- When moving to the other workq's we tightened up some object states
  and some lock handling.
- Properly syncs adds/deletes
- minor code cleanups
  - directly reference fc_host_attrs, rather than through attribute
    macros
  - flush the right workq on delayed work cancel failures.

Large kudos to Michael Reed who has been working this issue for the last
month.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aic79xx: target hotplug fixes
Hannes Reinecke [Fri, 7 Apr 2006 11:47:03 +0000 (13:47 +0200)]
[SCSI] aic79xx: target hotplug fixes

When a target is added aic79xx tries to be overly clever: it changes
the command on the fly to TEST UNIT READY and tries to requeue the
original command. Sadly this breaks SCSI compability and of course
the midlayer is getting a bit confused by it.

So we're just removing that bit of code and let the midlayer deal with
it. It's clever enough by now. And the driver code is getting simpler.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ibmvscsi: remove drivers/scsi/ibmvscsi/srp.h
FUJITA Tomonori [Sun, 26 Mar 2006 01:19:10 +0000 (10:19 +0900)]
[SCSI] ibmvscsi: remove drivers/scsi/ibmvscsi/srp.h

It's no longer needed after the convrsion to use the linux srp.h file.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aic79xx bus reset update
Hannes Reinecke [Mon, 3 Apr 2006 06:19:34 +0000 (08:19 +0200)]
[SCSI] aic79xx bus reset update

As James B. correctly noted, ahd_reset_channel() in
ahd_linux_bus_reset() should be protected by ahd_lock().  However, the
main reason for not doing so was a deadlock with the interesting
polling mechanism to detect the end a bus reset.

This patch replaces the polling mechanism with a saner signalling via
flags; it also gives us the benefit of detecting any multiple calls to
ahd_reset_channel().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] add SCSI_UNKNOWN and LUN transfer limit restrictions
James Bottomley [Sat, 1 Apr 2006 02:07:45 +0000 (20:07 -0600)]
[SCSI] add SCSI_UNKNOWN and LUN transfer limit restrictions

Original From: Ingo Flaschberger <if@xip.at>

To support the RA4100 array from Compaq.

This patch now correctly handles SCSI_UNKNOWN types with regard to
BLIST_REPORTLUNS2 (allow it) and cdb[1] LUN inclusion (don't).

It also allows a BLIST_MAX_512 flag to restrict the maximum transfer
length to 512 blocks (apparently this is an RA4100 problem).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] sym2: Fix build when spinlock debugging is enabled
Matthew Wilcox [Wed, 29 Mar 2006 21:45:18 +0000 (14:45 -0700)]
[SCSI] sym2: Fix build when spinlock debugging is enabled

When spinlock debugging is turned on, a struct completion grows beyond the
size allowed for the scsi_pointer.  So move the struct completion back onto
the stack.  The additional memory barriers are to keep us from completing
a random piece of kernel stack if the command happens to complete after
the error handling has finished.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: Bump version
Brian King [Wed, 29 Mar 2006 15:37:49 +0000 (09:37 -0600)]
[SCSI] ipr: Bump version

Bump ipr driver version to 2.1.3

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: Reset device cleanup
Brian King [Wed, 29 Mar 2006 15:37:43 +0000 (09:37 -0600)]
[SCSI] ipr: Reset device cleanup

Encapsulate some more of the device reset processing in
preparation for SATA support.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: printk macro cleanup/removal
Brian King [Wed, 29 Mar 2006 15:37:37 +0000 (09:37 -0600)]
[SCSI] ipr: printk macro cleanup/removal

Remove some unused printk macros, make some more robust, and
convert some to use standard printk macros when possible.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: Simplify status area dumping
Brian King [Wed, 29 Mar 2006 15:37:29 +0000 (09:37 -0600)]
[SCSI] ipr: Simplify status area dumping

Simplify the dumping of the command status area by
removing some device specific information that has proven
to not be worthwhile.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: Fixup device type check
Brian King [Wed, 29 Mar 2006 15:37:22 +0000 (09:37 -0600)]
[SCSI] ipr: Fixup device type check

Fixup a check used by the ipr driver to determine if a given
device is a SCSI disk. Due to the addition of support for
attaching SATA devices, this check needs to be more robust.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] ipr: Disk remove path cleanup
Brian King [Wed, 29 Mar 2006 15:37:16 +0000 (09:37 -0600)]
[SCSI] ipr: Disk remove path cleanup

Instead of NULLing the resource entry pointer when a disk
goes away to prevent any new commands being sent to it,
set the adapter resource handle to an invalid value so
new ops getting sent to it will fail with a selection timeout
response. This patch is needed for future SATA patches.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] sg: fix leak when dio setup fails
Douglas Gilbert [Tue, 28 Mar 2006 19:48:22 +0000 (14:48 -0500)]
[SCSI] sg: fix leak when dio setup fails

when the sg driver is unable to setup direct IO, free that scatter
gather list prior to falling back to indirect IO

Further to this thread started by Bryan Holty:
http://marc.theaimsgroup.com/?l=linux-scsi&m=114306885116728&w=2

Here is the reworked patch again. This time it has been
tested with a program provided by Bryan.

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] expose sas internal class for the domain transport
James Bottomley [Mon, 27 Mar 2006 22:45:34 +0000 (16:45 -0600)]
[SCSI] expose sas internal class for the domain transport

necessary to make the domain class use the internal structures

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] for_each_possible_cpu: scsi
KAMEZAWA Hiroyuki [Tue, 28 Mar 2006 22:50:58 +0000 (14:50 -0800)]
[SCSI] for_each_possible_cpu: scsi

for_each_cpu() actually iterates across all possible CPUs.  We've had mistakes
in the past where people were using for_each_cpu() where they should have been
iterating across only online or present CPUs.  This is inefficient and
possibly buggy.

We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the
future.

This patch replaces for_each_cpu with for_each_possible_cpu.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Version 2.2.3
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Version 2.2.3

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Enable clustering and large transfers
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Enable clustering and large transfers

This patch enables clustering and sets max_sectors to 0xffff to enable
reading and writing of large blocks with tapes (and large transfers with
sg). This change is needed after the sg and st drivers started using
chained bios through scsi_request_async() in 2.6.16.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Simplify error handling
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Simplify error handling

Use wait_for_completion_timeout() instead of using a timer (as
Christoph Hellwig did for aic7xxx).

That lets me eliminate the sym_eh_wait structure; the struct completion,
the old_done pointer and the to_do flag can be folded into the sym_ucmd
(which overrides the scsi_pointer in scsi_cmnd).

The sym_eh_done() function becomes much simpler as the timeout handling
is done in sym_eh_handler() directly.

The host_lock can be unlocked earlier, and I cache the host in
a local variable to make accesses to it quicker.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Allow nvram settings to determine bus mode
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Allow nvram settings to determine bus mode

The PDC code can set the bus mode, but we were ignoring that setting.
Also move the code that determines bus mode into its own function.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Use SPI messages where possible
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Use SPI messages where possible

Now sym2 is using spi_print_msg, we don't need to have our own messages
for IGNORE WIDE RESIDUE and MODIFY DATA POINTER, so provide the option
of passing NULL for the label.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Disable sym2 driver queueing
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Disable sym2 driver queueing

Undef SYM_OPT_HANDLE_DEVICE_QUEUEING.
Call sym_put_start_queue instead of sym_start_next_ccbs.
Turn asserts into checks that we can send the command to the adapter,
and return busy from queuecommand if we can't.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Mark div_10M array const
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Mark div_10M array const

Patch below is one out of a large series to mark kernel data const when
possible, goal is to use .rodata and avoid false sharing

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Simplify error handling a bit
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Simplify error handling a bit

 - to_do was never set to SYM_EH_DO_COMPLETE, so remove that code
 - move the spinlocks inside the common error handler code path

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Use pcibios_resource_to_bus()
Matthew Wilcox [Tue, 28 Mar 2006 16:03:44 +0000 (11:03 -0500)]
[SCSI] Use pcibios_resource_to_bus()

We had our own code (pci_get_base_address()) to get the bus address of
a BAR.  We can get this using pcibios_resource_to_bus() instead.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] Change Kconfig option from IOMAPPED to MMIO
Matthew Wilcox [Tue, 28 Mar 2006 16:03:43 +0000 (11:03 -0500)]
[SCSI] Change Kconfig option from IOMAPPED to MMIO

Most of the Kconfig options for switching between IO Port and MMIO
operations use the opposite sense from sym2.  Really, this option
should be set at a chipset level rather than per-driver.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] sas transport: ref count update
Mike Anderson [Mon, 27 Mar 2006 17:37:28 +0000 (09:37 -0800)]
[SCSI] sas transport: ref count update

Fix puts so that release functions will be called.

Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: Driver version update
Mark Haverkamp [Mon, 27 Mar 2006 17:44:37 +0000 (09:44 -0800)]
[SCSI] aacraid: Driver version update

Received from Mark Salyzyn

Fix module param
Update driver version.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: Fix parenthesis placement error
Mark Haverkamp [Mon, 27 Mar 2006 17:44:33 +0000 (09:44 -0800)]
[SCSI] aacraid: Fix parenthesis placement error

Received from Mark Salyzyn

On 64 bit machines, when a 32 bit application tries to acquire the AIF,
they will always get and EFAULT error response from the driver.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: Show max channel and max id is sysfs
Mark Haverkamp [Mon, 27 Mar 2006 17:44:29 +0000 (09:44 -0800)]
[SCSI] aacraid: Show max channel and max id is sysfs

Received from Mark Salyzyn

Add max_channel and max_id sysfs parameters.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: Re-start helper thread if it dies
Mark Haverkamp [Mon, 27 Mar 2006 17:44:26 +0000 (09:44 -0800)]
[SCSI] aacraid: Re-start helper thread if it dies

Received from Mark Salyzyn

Since the helper thread for the driver can be killed unceremoniously by
an application, we detect the loss of the helper and restart it.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
18 years ago[SCSI] aacraid: General driver cleanup
Mark Haverkamp [Mon, 27 Mar 2006 17:44:23 +0000 (09:44 -0800)]
[SCSI] aacraid: General driver cleanup

Received from Mark Salyzyn

Remove superfluous code, optimize code, harden code, cast code, correct
some text, use msleep instead of schedule_timeout_interruptible. No
bugs.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>