openwrt/staging/blogic.git
15 years ago[SCSI] scsi_dh_rdac: Retry for NOT_READY check condition
Chauhan, Vijay [Tue, 17 Mar 2009 13:21:40 +0000 (18:51 +0530)]
[SCSI] scsi_dh_rdac: Retry for NOT_READY check condition

This patch adds retry for NOT_READY check condition - Quiesce in
progress (02/A1/02)

Signed-off-by: Vijay Chauhan<vijay.chauhan@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] mpt2sas: make global symbols unique
Eric Moore [Mon, 16 Mar 2009 03:37:18 +0000 (21:37 -0600)]
[SCSI] mpt2sas: make global symbols unique

The ioc_list global symbol is already used in 1st generation mpt
fusion drivers, so this patch makes it unique in the 2nd generation
driver.  I've checked the entire sources, and I don't see any other
global system missing the mpt2sas_xxx prefix.

Signed-off-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sd: Make revalidate less chatty
Martin K. Petersen [Mon, 9 Mar 2009 15:33:31 +0000 (11:33 -0400)]
[SCSI] sd: Make revalidate less chatty

sd_revalidate ends up being called several times during device setup.
With this patch we print everything during the first scan.  Subsequent
invocations will only print a message if the parameter in question has
actually changed (LUN capacity has increased, etc.).

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sd: Try READ CAPACITY 16 first for SBC-2 devices
Matthew Wilcox [Thu, 12 Mar 2009 18:20:30 +0000 (14:20 -0400)]
[SCSI] sd: Try READ CAPACITY 16 first for SBC-2 devices

New features are being added to the READ CAPACITY 16 results, so we
want to issue it in preference to READ CAPACITY 10.  Unfortunately, some
devices misbehave when they see a READ CAPACITY 16, so we restrict this
command to devices which claim conformance to SPC-3 (aka SBC-2), or claim
they have features which are only reported in the READ CAPACITY 16 data.

The READ CAPACITY 16 command is optional, even for SBC-2 devices, so
we fall back to READ CAPACITY 10 if READ CAPACITY 16 fails.

[jejb: don't error if device supports SBC-2 but doesn't support RC16]
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Tested-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sd: Refactor sd_read_capacity()
Matthew Wilcox [Thu, 12 Mar 2009 18:20:29 +0000 (14:20 -0400)]
[SCSI] sd: Refactor sd_read_capacity()

The sd_read_capacity() function was about 180 lines long and
included a backwards goto and a tricky state variable.  Splitting out
read_capacity_10() and read_capacity_16() (about 50 lines each) reduces
sd_read_capacity to about 100 lines and gets rid of the backwards goto
and the state variable.  I've tried to avoid any behaviour change with
this patch.

[jejb: upped transfer request to standard recommended 32 for RC16]
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] mpt2sas v00.100.11.15
Eric Moore [Mon, 9 Mar 2009 07:21:12 +0000 (01:21 -0600)]
[SCSI] mpt2sas v00.100.11.15

* This is new scsi lld device driver from LSI supporting the SAS 2.0
  standard. I have split patchs by filename.

* Here is list of new 6gb host controllers:

  LSI SAS2004
  LSI SAS2008
  LSI SAS2108
  LSI SAS2116

* Here are the changes in the 4th posting of this patch set:

(1) fix compile errors when SCSI_MPT2SAS_LOGGING is not enabled
(2) add mpt2sas to the SCSI Mid Layer Makefile
(3) append mpt2sas_ to the naming of all non-static functions
(4) fix oops for SMP_PASSTHRU
(5) doorbell algorithm imported changes from windows driver

* Here are the changes in the 3rd posting of this patch set:

(1) add readl following writel from the function that disables interrupts
(2) replace 0xFFFFFFFFFFFFFFFFULL with ~0ULL
(3) when calling pci_enable_msix, only pass one msix entry (instead of 15).
(4) remove the "current HW implementation uses..... " comment in the sources
(5) merged bug fix for SIGIO/POLLIN notifcation; reported by the storlib team.

* Here are the changes in the 2nd posting of this patch set:

(1) use little endian types in the mpi headers
(2) merged in bug fix's from inhouse drivers.

Signed-off-by: Eric Moore <eric.moore@lsi.com>
Tested-by: peter Bogdanovic <pbog@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] mpt2sas: add MPT2SAS_MINOR(221) to miscdevice.h
Eric Moore [Mon, 9 Mar 2009 07:27:49 +0000 (01:27 -0600)]
[SCSI] mpt2sas: add MPT2SAS_MINOR(221) to miscdevice.h

Signed-off-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ch: Add scsi type modalias
Scott James Remnant [Tue, 10 Mar 2009 16:19:44 +0000 (16:19 +0000)]
[SCSI] ch: Add scsi type modalias

The ch module is missing the scsi:t-0x08* alias that would cause it to
be auto-loaded when a device of that type if found by udev, requiring
udev to have a specific rule just for this one module.  This patch adds
the alias.

Signed-off-by: Scott James Remnant <scott@canonical.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] 3w-9xxx: add power management support
adam radford [Mon, 9 Mar 2009 20:15:01 +0000 (12:15 -0800)]
[SCSI] 3w-9xxx: add power management support

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] bsg: add linux/types.h include to bsg.h
Douglas Gilbert [Mon, 9 Mar 2009 14:51:38 +0000 (10:51 -0400)]
[SCSI] bsg: add linux/types.h include to bsg.h

Since bsg.h has recently been added to the list of kernel
headers that should be exported to the user space, this
attachment makes bsg.h more user space "friendly".
Specifically autotools dislike headers that don't compile
freestanding and bsg.h's use of __u32 types (and friends)
are not standard C (C90 or C99). The inclusion of
linux/types.h fixes that.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] cxgb3i: fix function descriptions
Karen Xie [Thu, 5 Mar 2009 20:46:08 +0000 (14:46 -0600)]
[SCSI] cxgb3i: fix function descriptions

Limit function descriptions to be one line.

Signed-off-by: Karen Xie <kxie@chelsio.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi: fix possbile null ptr session command cleanup
Mike Christie [Thu, 5 Mar 2009 20:46:07 +0000 (14:46 -0600)]
[SCSI] libiscsi: fix possbile null ptr session command cleanup

If the iscsi eh fires when the current task is a nop, then
the task->sc pointer is null. fail_all_commands could
then try to do task->sc->device and oops. We actually do
not need to access the curr task in this path, because
if it is a cmd task the fail_command call will handle
this and if it is mgmt task then the flush of the mgmt
queues will handle that.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi class: remove host no argument from session creation callout
Mike Christie [Thu, 5 Mar 2009 20:46:06 +0000 (14:46 -0600)]
[SCSI] iscsi class: remove host no argument from session creation callout

We do not need to have llds set the host no for the session's
parent, because we know the session's parent is going to be
the host. This removes it from the session creation callback
and converts the drivers.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi: pass session failure a session struct
Mike Christie [Thu, 5 Mar 2009 20:46:05 +0000 (14:46 -0600)]
[SCSI] libiscsi: pass session failure a session struct

The api for conn and session failures is akward because
one takes a conn from the lib and one takes a session
from the class. This syncs up the interfaces to use
structs from the lib.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi lib: remove qdepth param from iscsi host allocation
Mike Christie [Thu, 5 Mar 2009 20:46:04 +0000 (14:46 -0600)]
[SCSI] iscsi lib: remove qdepth param from iscsi host allocation

The qdepth setting was useful when we needed libiscsi to verify
the setting. Now we just need to make sure if older tools
passed in zero then we need to set some default.

So this patch just has us use the sht->cmd_per_lun or if
for LLD does a host per session then we can set it on per
host basis.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi lib: have lib create work queue for transmitting IO
Mike Christie [Thu, 5 Mar 2009 20:46:03 +0000 (14:46 -0600)]
[SCSI] iscsi lib: have lib create work queue for transmitting IO

We were using the shost work queue which ended up being
a little akward since all iscsi hosts need a thread for
scanning, but only drivers hooked into libiscsi need
a workqueue for transmitting. So this patch moves the
xmit workqueue to the lib.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi class: fix lock dep warning on logout
Mike Christie [Thu, 5 Mar 2009 20:46:02 +0000 (14:46 -0600)]
[SCSI] iscsi class: fix lock dep warning on logout

We never should hit the lock up that is spit out when
lock dep is on and we logout. But we have been using the
shost work queue in a odd way. This patch has us use the
work queue for scanning instead of creating our own,
and this ends up also killing the lock dep warnings.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi: don't cap queue depth in iscsi modules
Mike Christie [Thu, 5 Mar 2009 20:46:01 +0000 (14:46 -0600)]
[SCSI] libiscsi: don't cap queue depth in iscsi modules

There is no need to cap the queue depth in the modules. We set
this in userspace and can do that there. For performance testing
with ram based targets, this is helpful since we can have very
high queue depths.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi_tcp: replace scsi_debug/tcp_debug logging with iscsi conn logging
Mike Christie [Thu, 5 Mar 2009 20:46:00 +0000 (14:46 -0600)]
[SCSI] iscsi_tcp: replace scsi_debug/tcp_debug logging with iscsi conn logging

This makes the logging a compile time option and replaces
the tcp_debug macro with a iscsi connection one that prints
out a driver model id prefix.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi_tcp: replace tcp_debug/scsi_debug logging with session/conn logging
Mike Christie [Thu, 5 Mar 2009 20:45:59 +0000 (14:45 -0600)]
[SCSI] libiscsi_tcp: replace tcp_debug/scsi_debug logging with session/conn logging

This makes the logging a compile time option and replaces
the scsi_debug and tcp_debug macro with session and connection ones
that print out a driver model id prefix.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi: replace scsi_debug logging with session/conn logging
Mike Christie [Thu, 5 Mar 2009 20:45:58 +0000 (14:45 -0600)]
[SCSI] libiscsi: replace scsi_debug logging with session/conn logging

This makes the logging a compile time option and replaces
the scsi_debug macro with session and connection ones
that print out a driver model id prefix.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iser: have iser use its own logging
Mike Christie [Thu, 5 Mar 2009 20:45:57 +0000 (14:45 -0600)]
[SCSI] iser: have iser use its own logging

iser has its own logging inrfastrucutre. Convert it to use
it instead of libiscsi.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] iscsi tcp: bidi capable
Pete Wyckoff [Thu, 5 Mar 2009 20:45:56 +0000 (14:45 -0600)]
[SCSI] iscsi tcp: bidi capable

Mark iscsi_tcp as being capable of bidirectional transfers.  The
bsg interface checks this bit before attempting any bidirectional
commands.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libiscsi: fix iscsi pool error path
Jean Delvare [Thu, 5 Mar 2009 20:45:55 +0000 (14:45 -0600)]
[SCSI] libiscsi: fix iscsi pool error path

Memory freeing in iscsi_pool_free() looks wrong to me. Either q->pool
can be NULL and this should be tested before dereferencing it, or it
can't be NULL and it shouldn't be tested at all. As far as I can see,
the only case where q->pool is NULL is on early error in
iscsi_pool_init(). One possible way to fix the bug is thus to not
call iscsi_pool_free() in this case (nothing needs to be freed anyway)
and then we can get rid of the q->pool check.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: fcoe fc crc offload indication by skb->ip_summed
Yi Zou [Fri, 27 Feb 2009 22:07:31 +0000 (14:07 -0800)]
[SCSI] fcoe: fcoe fc crc offload indication by skb->ip_summed

If LLD supports FCCRC offload, it should set ip_summed to be
CHECKSUM_UNNECESSARY so we don't have to do CRC check again.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: add support to FCoE offload support in fcoe_sw through net_device
Yi Zou [Fri, 27 Feb 2009 22:07:26 +0000 (14:07 -0800)]
[SCSI] fcoe: add support to FCoE offload support in fcoe_sw through net_device

This adds implementation of ddp_setup()/ddp_done() in fcoe_sw for its
fcoe_sw_libfc_fcn_templ.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: add support of large receive offload by ddp in fc_fcp
Yi Zou [Fri, 27 Feb 2009 22:07:21 +0000 (14:07 -0800)]
[SCSI] libfc: add support of large receive offload by ddp in fc_fcp

When LLD supports direct data placement (ddp) for large receive of an scsi
i/o coming into fc_fcp, we call into libfc_function_template's ddp_setup()
to prepare for a ddp of large receive for this read I/O. When I/O is complete,
we call the corresponding ddp_done() to get the length of data ddped as well
as to let LLD do clean up.

fc_fcp_ddp_setup()/fc_fcp_ddp_done() are added to setup and complete a ddped
read I/O described by the given fc_fcp_pkt. They would call into corresponding
ddp_setup/ddp_done implemented by the fcoe layer. Eventually, fcoe layer calls
into LLD's ddp_setup/ddp_done provided through net_device

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: add support to large send by gso through net_device for fcoe_sw
Yi Zou [Fri, 27 Feb 2009 22:07:15 +0000 (14:07 -0800)]
[SCSI] fcoe: add support to large send by gso through net_device for fcoe_sw

Change fcoe_xmit to setup gso for LLD LSO offload as well as CRC offload

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: use lso_max for sequence offload
Yi Zou [Fri, 27 Feb 2009 22:07:10 +0000 (14:07 -0800)]
[SCSI] libfc: use lso_max for sequence offload

Make sure for large send is supported by LLD in outgoing FCP data, we are only
sending the lso_max a time in one single large send, since that is what
supported by LLD.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe, libfc: check offload features from LLD through netdev
Yi Zou [Fri, 27 Feb 2009 22:07:04 +0000 (14:07 -0800)]
[SCSI] fcoe, libfc: check offload features from LLD through netdev

This checks if net_devices supports FCoE offload ops in netdev_ops and it
if it does, then sets up the corresponding flags in the associated fc_lport.

For large send offload, the maximum length supported in one large send is now
described by the added lso_max in fc_lport, which is setup initially from
netdev->gso_max_size.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] net: add FCoE offload support through net_device
Yi Zou [Fri, 27 Feb 2009 22:06:59 +0000 (14:06 -0800)]
[SCSI] net: add FCoE offload support through net_device

This adds support to provide Fiber Channel over Ethernet (FCoE) offload
through net_device's net_device_ops struct. The offload through net_device
for FCoE is enabled in kernel as built-in or module driver.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] net: add NETIF_F_FCOE_CRC to can_checksum_protocol
Yi Zou [Fri, 27 Feb 2009 22:06:54 +0000 (14:06 -0800)]
[SCSI] net: add NETIF_F_FCOE_CRC to can_checksum_protocol

Add FC CRC offload check for ETH_P_FCOE.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] net: define feature flags for FCoE offloads
Chris Leech [Fri, 27 Feb 2009 22:06:49 +0000 (14:06 -0800)]
[SCSI] net: define feature flags for FCoE offloads

Define feature flags for FCoE offloads.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] net: reclaim 8 upper bits of the netdev->features from GSO
Chris Leech [Fri, 27 Feb 2009 22:06:43 +0000 (14:06 -0800)]
[SCSI] net: reclaim 8 upper bits of the netdev->features from GSO

Reclaim 8 upper bits of netdev->features from GSO.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] net, fcoe: add ETH_P_FCOE for Fibre Channel over Ethernet (FCoE)
Yi Zou [Fri, 27 Feb 2009 22:06:37 +0000 (14:06 -0800)]
[SCSI] net, fcoe: add ETH_P_FCOE for Fibre Channel over Ethernet (FCoE)

This adds eth type ETH_P_FCOE for Fibre Channel over Ethernet (FCoE),
consequently, the ETH_P_FCOE from fc_fcoe.h and fcoe skb->protocol
is not set as ETH_P_FCOE.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi_dh_rdac: Retry mode select for NO_SENSE, ABORTED_COMMAND, UNIT_ATTENTION...
Chauhan, Vijay [Wed, 4 Mar 2009 06:47:54 +0000 (12:17 +0530)]
[SCSI] scsi_dh_rdac: Retry mode select for NO_SENSE, ABORTED_COMMAND, UNIT_ATTENTION, NOT_READY(02/04/01)

This patch is to add retry for mode select if mode select command is
returned with sense NO_SENSE, UNIT_ATTENTION, ABORTED_COMMAND,
NOT_READY(02/04/01). This patch reorganise the sense keys from if-else
to switch-case format for better maintainability.

Signed-off-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Acked-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Report fc_host_port_type as NPIV
Christof Schmitt [Mon, 2 Mar 2009 12:09:06 +0000 (13:09 +0100)]
[SCSI] zfcp: Report fc_host_port_type as NPIV

Report the fc_host_port_type as FC_PORTTYPE_NPIV when the subchannel
is running in NPIV mode. This allows to see the correct type with
lsscsi -H -t --list

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Ensure all work is cancelled on adapter dequeue
Swen Schillig [Mon, 2 Mar 2009 12:09:11 +0000 (13:09 +0100)]
[SCSI] zfcp: Ensure all work is cancelled on adapter dequeue

A scheduled work might still be pending, running while the adapter is
in progress to get dequeued from the system. This can lead to an
invalid pointer dereference (Oops).  Once the adpater is set online
again, ensure the nameserver environment is initialized to the
appropriate values again.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: fix queue, scheduled work processing.
Swen Schillig [Mon, 2 Mar 2009 12:09:10 +0000 (13:09 +0100)]
[SCSI] zfcp: fix queue, scheduled work processing.

Ensure the refcounting is correct even if we were not able to
schedule a work. In addition we have to make sure no scheduled
work is pending while we're dequeing the adapter from the
systems environment.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: erp failed status bit will not be set
Martin Petermann [Mon, 2 Mar 2009 12:09:09 +0000 (13:09 +0100)]
[SCSI] zfcp: erp failed status bit will not be set

It will not be necessary to set the erp failed status bit
in case a SCSI device is removed by the SCSI mid layer.
In the case a SCSI device is unavailable for a short time
(15 to 20 seconds) a FCP unit will not get on-line again.

Signed-off-by: Martin Petermann <martin@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Block FC transport rports early on errors
Christof Schmitt [Mon, 2 Mar 2009 12:09:08 +0000 (13:09 +0100)]
[SCSI] zfcp: Block FC transport rports early on errors

Use the I/O blocking mechanism in the FC transport class to allow
faster failovers for multipathing:
- Call fc_remote_port_delete early to set the rport to BLOCKED.
- Check the rport status in queuecommand with fc_remote_portchkready
  to no longer accept new I/O for this port and fail the I/O with the
  appropriate scsi_cmnd result.
- Implement the terminate_rport_io handler to abort all pending I/O
  requests
- Return SCSI commands with DID_TRANSPORT_DISRUPTED while erp is
  running.
- When updating the remote port status, check for late changes and
  update the remote ports status accordingly.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: incorrect reaction on incoming RSCN
Swen Schillig [Mon, 2 Mar 2009 12:09:07 +0000 (13:09 +0100)]
[SCSI] zfcp: incorrect reaction on incoming RSCN

After an error condition resolved a remote storage port was never
re-opened. The incoming RSCN was not processed accordingly due
to a misinterpreted status flag / return value combination.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Remove PCI flag
Christof Schmitt [Mon, 2 Mar 2009 12:09:05 +0000 (13:09 +0100)]
[SCSI] zfcp: Remove PCI flag

The usage of the PCI flag to trigger interrupts is optional. Even
without setting the flag, qdio still receives interrupts to continue
working on the queue.  Remove the PCI flag from zfcp, it is not
necessary.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: replace current ERP logging with a more convenient version
Swen Schillig [Mon, 2 Mar 2009 12:09:04 +0000 (13:09 +0100)]
[SCSI] zfcp: replace current ERP logging with a more convenient version

The current number based id ERP logging is replaced by a string
based tag version. The benefit is an easier location of the code in
question and the removal of the lengthy array referencing the
individual messages.
The string (7 bytes) based version does not use more space since those
bytes were "used" anyway due to the alignment of the structure.
The encoding of the 7 byte string is as follows
        [0-1] = filename
        [2-5] = task/function
        [6]   = section
Due to the character of this string (fixed length) a string
termination is not required here.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: prevent adapter close on initial adapter open
Swen Schillig [Mon, 2 Mar 2009 12:09:03 +0000 (13:09 +0100)]
[SCSI] zfcp: prevent adapter close on initial adapter open

An adapter close was always performed whether it was required,
(e.g. in an error scenario) or not (e.g. initial open).
This patch is changing the process in only doing an
adapter close when it is required.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: remove undefined subtype for status read response
Swen Schillig [Mon, 2 Mar 2009 12:09:02 +0000 (13:09 +0100)]
[SCSI] zfcp: remove undefined subtype for status read response

The status read response FSF_STATUS_READ_SUB_ERROR_PORT is not
defined in the specs and therefore not valid.
All occurrences are removed from the code.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Send ELS ADISC from workqueue
Christof Schmitt [Mon, 2 Mar 2009 12:09:01 +0000 (13:09 +0100)]
[SCSI] zfcp: Send ELS ADISC from workqueue

Issue ELS ADISC requests from workqueue. This allows the link test
request to be sent when the request queue is full due to I/O load for
other remote ports. It also simplifies request queue locking,
zfcp_fsf_send_fcp_command_task is now the only function that has
interrupts disabled from the caller. This is also a prereq for the FC
passthrough support that issues ELS requests from userspace.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Improve reliability of SCSI eh handlers in zfcp
Christof Schmitt [Mon, 2 Mar 2009 12:09:00 +0000 (13:09 +0100)]
[SCSI] zfcp: Improve reliability of SCSI eh handlers in zfcp

When the SCSI midlayer is running error recovery, the low-level error
recovery in zfcp could be running and preventing the SCSI midlayer to
issue error recovery requests. To avoid unnecessary error recovery
escalation, wait for the zfcp erp to finish and retry if necessary.

While reworking the SCSI eh handlers, alsa cleanup the code and
simplify the interface from zfcp_scsi to the fsf layer.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Wait for free SBALs when possible
Christof Schmitt [Mon, 2 Mar 2009 12:08:59 +0000 (13:08 +0100)]
[SCSI] zfcp: Wait for free SBALs when possible

For calls from zfcp erp, scsi_eh and sysfs switch the calls issuing
FSF requests to zfcp_fsf_req_sbal_get to wait for free SBALs.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Only increment req_id for successfully issued requests
Christof Schmitt [Mon, 2 Mar 2009 12:08:58 +0000 (13:08 +0100)]
[SCSI] zfcp: Only increment req_id for successfully issued requests

Only increment the req_id for successfully issued requests. This
avoids some confusion when debugging issued fsf requests.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Simplify latency lock handling
Christof Schmitt [Mon, 2 Mar 2009 12:08:57 +0000 (13:08 +0100)]
[SCSI] zfcp: Simplify latency lock handling

The lock only needs to protect the softirq context called from qdio
against the userspace context called from sysfs. spin_lock and
spin_lock_bh is enough.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: add measurement data for average qdio queue utilisation
Martin Peschke [Mon, 2 Mar 2009 12:08:56 +0000 (13:08 +0100)]
[SCSI] zfcp: add measurement data for average qdio queue utilisation

Provide measurement data for the utilisation of the QDIO outbound queue.
The additional value allows to calculate an average queue utilisation
by looking at the deltas per time unit. Needed for capacity planning.
It is up to user space to handle wrap-arounds of the 64 bit value.

The new counter neatly complements the existing counter for queue full
conditions. That is why, both statistics counter have been integrated.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Remove UNIT_REGISTERED status flag
Christof Schmitt [Mon, 2 Mar 2009 12:08:55 +0000 (13:08 +0100)]
[SCSI] zfcp: Remove UNIT_REGISTERED status flag

Use the device pointer in zfcp_unit for tracking if we have a
registered SCSI device. With this approach, the flag
ZFCP_STATUS_UNIT_REGISTERED is only redundant and can be removed.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] zfcp: Remove some port flags
Christof Schmitt [Mon, 2 Mar 2009 12:08:54 +0000 (13:08 +0100)]
[SCSI] zfcp: Remove some port flags

PORT_PHYS_CLOSING is only set and cleared, but not actually used
for status checking.

PORT_INVALID_WWPN is set when the GID_PN request does not return
a d_id for a remote port, e.g. when a remote port has been
unplugged. For this case, the d_id is zero. In the erp we can
check the d_id and use the normal escalation procedure that gives
up after three retries and remove the special case.

PORT_NO_WWPN is unused: Each port in the remote port list has a
valid wwpn. The WKA ports are now tracked outside the port
list. Remove the PORT_NO_WWPN flag, since this is no longer set
for any port.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fix /proc memory leak in the SCSI core
Alan Stern [Fri, 27 Feb 2009 21:51:42 +0000 (16:51 -0500)]
[SCSI] fix /proc memory leak in the SCSI core

The SCSI core calls scsi_proc_hostdir_add() from within
scsi_host_alloc(), but the corresponding scsi_proc_hostdir_rm()
routine is called from within scsi_remove_host().  As a result, if a
host is allocated and then deallocated without ever being registered,
the host's directory in /proc is leaked.

This patch (as1181b) fixes this bug in the SCSI core by moving
scsi_proc_hostdir_rm() into scsi_host_dev_release().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: don't flood syslog with negotiation messages
Tony Battersby [Thu, 8 Jan 2009 17:59:08 +0000 (12:59 -0500)]
[SCSI] sym53c8xx: don't flood syslog with negotiation messages

sym53c8xx prints a negotiation message after every check condition.
This can add up to a lot of messages for removable-medium devices
(CD-ROM, tape drives, etc.) that are being polled, since they return
check condition when no medium is present.  This patch suppresses the
negotiation message if it would be the same as the last one printed.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: use a queue depth of 1 for untagged devices
Tony Battersby [Thu, 8 Jan 2009 17:58:04 +0000 (12:58 -0500)]
[SCSI] sym53c8xx: use a queue depth of 1 for untagged devices

sym53c8xx uses a command queue depth of 2 for untagged devices,
without good reason.  This _mostly_ seems to work ok, but it has
caused me some subtle problems.  For example, I have an application
where one thread sends write commands to a tape drive, and another
thread sends log sense polling commands.  With a queue depth of
2, the polling commands end up being starved for long periods of
time while multiple write commands are serviced (this may also be
related to the fact the the sg driver queues commands in LIFO order).
This problem is fixed by changing the queue depth to 1 for untagged
devices.  I have tested this change extensively with many different
tape drives, medium changers, and disk drives (disk drives of course
use tagged commands and are therefore unaffected by this patch).

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: handle pci_iomap() failures
Tony Battersby [Thu, 8 Jan 2009 17:56:58 +0000 (12:56 -0500)]
[SCSI] sym53c8xx: handle pci_iomap() failures

sym_init_device() doesn't check if pci_iomap() fails.  It also tries
to map device RAM without first checking FE_RAM.

1) Move some initialization from sym_init_device() to the top of
   sym2_probe().
2) Rename sym_init_device() to sym_iomap_device().
3) Call sym_iomap_device() after sym_check_supported() instead of
   before so that device->chip.features will be set.
4) Check FE_RAM in sym_iomap_device() before mapping RAM.
5) If sym_iomap_device() cannot map registers, then abort.
6) If sym_iomap_device() cannot map RAM, then fall back to not using
   RAM and continue.
7) Remove the check for FE_RAM in sym_attach() since dev->ram_base
   is now always set correctly.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: unmap pci memory after probe errors
Tony Battersby [Thu, 8 Jan 2009 17:55:52 +0000 (12:55 -0500)]
[SCSI] sym53c8xx: unmap pci memory after probe errors

During sym2_probe(), sym_init_device() does pci_iomap(), but there is
no corresponding pci_iounmap() if an error occurs before sym_attach()
copies sym_device::s.{ioaddr,ramaddr} to np.
1) Add the sym_iounmap_device() function.
2) Call sym_iounmap_device() if an error occurs between
   sym_init_device() and the time sym_attach() allocates np.
3) Make sym_attach() copy sym_device::s.{ioaddr,ramaddr} to np before
   calling any function that can fail so that sym_free_resources()
   will do the unmap instead of sym_iounmap_device().

Also fixed by this patch:
During sym2_probe(), if sym_check_raid() returns nonzero, then
pci_release_regions() is never called.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: fix bogus free_irq() on error path
Tony Battersby [Thu, 8 Jan 2009 17:54:45 +0000 (12:54 -0500)]
[SCSI] sym53c8xx: fix bogus free_irq() on error path

If sym_attach() gets an error at or before request_irq(), then
sym_free_resources() will call free_irq() for an unregistered
interrupt handler.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: fix NULL deref on error path
Tony Battersby [Thu, 8 Jan 2009 17:53:37 +0000 (12:53 -0500)]
[SCSI] sym53c8xx: fix NULL deref on error path

If sym_attach() fails to allocate np, the error path will dereference
a NULL pointer for printk.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: fix shost use-after-free and memory leak
Tony Battersby [Thu, 8 Jan 2009 17:52:32 +0000 (12:52 -0500)]
[SCSI] sym53c8xx: fix shost use-after-free and memory leak

This patch fixes two bugs:

1) rmmod sym53c8xx uses shost after freeing it with
   scsi_put_host(shost).

2) insmod sym53c8xx doesn't call scsi_put_host(shost) if
   scsi_add_host() fails, causing a memory leak on the error path.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ipr: Expose debug and fastfail parameters
Wayne Boyer [Tue, 24 Feb 2009 19:36:00 +0000 (11:36 -0800)]
[SCSI] ipr: Expose debug and fastfail parameters

Expose the debug and fastfail parameters to /sys/module/ipr/parameters such
that they can be enabled/disabled at run time.

Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sd: tell the user when a disk's capacity is adjusted
Alan Stern [Wed, 18 Feb 2009 15:54:44 +0000 (10:54 -0500)]
[SCSI] sd: tell the user when a disk's capacity is adjusted

This patch (as1188) combines the tests for decrementing a drive's
reported capacity and expands the comment.  It also adds an
informational message to the system log, informing the user when the
reported value has been changed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ses: code_set == 1 is tested twice
Roel Kluin [Tue, 17 Feb 2009 15:59:24 +0000 (16:59 +0100)]
[SCSI] ses: code_set == 1 is tested twice

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: remove the own list management for struct sg_fd
FUJITA Tomonori [Mon, 16 Feb 2009 04:26:53 +0000 (13:26 +0900)]
[SCSI] sg: remove the own list management for struct sg_fd

This replaces the own list management for struct sg_fd with the
standard list_head structure.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: use ALIGN macro
FUJITA Tomonori [Wed, 11 Feb 2009 17:42:57 +0000 (02:42 +0900)]
[SCSI] sg: use ALIGN macro

This changes sg_build_indirect() to use ALIGN macro instead of
calculating by hand.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: remove unnecessary function declarations
FUJITA Tomonori [Wed, 11 Feb 2009 17:42:56 +0000 (02:42 +0900)]
[SCSI] sg: remove unnecessary function declarations

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: Correct use of ! and &
Julia Lawall [Wed, 4 Feb 2009 21:17:29 +0000 (22:17 +0100)]
[SCSI] libfc: Correct use of ! and &

!ep->esb_stat is either 1 or 0, and the rightmost bit of ESB_ST_COMPLETE is
always 0, making the result of !ep->esb_stat & ESB_ST_COMPLETE always 0.
Thus parentheses around the argument to ! seem needed.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ expression E; constant C; @@
(
  !E & !C
|
- !E & C
+ !(E & C)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] Make scsi.h independent of the rest of the scsi includes
James Bottomley [Mon, 9 Feb 2009 03:59:48 +0000 (21:59 -0600)]
[SCSI] Make scsi.h independent of the rest of the scsi includes

This allows it to compile and be used on the ps3 platform that wants
to use the #define values in scsi.h without actually having
CONFIG_SCSI set.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: Fix NULL dereference BUG when target is not OSD conformant
Boaz Harrosh [Sun, 8 Feb 2009 16:02:22 +0000 (18:02 +0200)]
[SCSI] libosd: Fix NULL dereference BUG when target is not OSD conformant

Very old OSC's Target had a BUG in the Get/Set attributes where
it was looking in the wrong places for attribute lists length.
If used with the open-osd initiator, the initiator would dereference
a NULL pointer when retrieving system_information attributes.

Checks are added that retrieval of each attribute is successful
before accessing its value.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: avoid blk_put_request/blk_rq_unmap_user in interrupt
FUJITA Tomonori [Wed, 4 Feb 2009 02:36:27 +0000 (11:36 +0900)]
[SCSI] sg: avoid blk_put_request/blk_rq_unmap_user in interrupt

This fixes the following oops:

http://marc.info/?l=linux-kernel&m=123316111415677&w=2

You can reproduce this bug by interrupting a program before a sg
response completes. This leads to the special sg state (the orphan
state), then sg calls blk_put_request in interrupt (rq->end_io).

The above bug report shows the recursive lock problem because sg calls
blk_put_request in interrupt. We could call __blk_put_request here
instead however we also need to handle blk_rq_unmap_user here, which
can't be called in interrupt too.

In the orphan state, we don't need to care about the data transfer
(the program revoked the command) so adding 'just free the resource'
mode to blk_rq_unmap_user is a possible option.

I prefer to avoid complicating the blk mapping API when possible. I
change the orphan state to call sg_finish_rem_req via
execute_in_process_context. We hold sg_fd->kref so sg_fd doesn't go
away until keventd_wq finishes our work. copy_from_user/to_user fails
so blk_rq_unmap_user just frees the resource without the data
transfer.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ibmvfc: Better handle other FC initiators
Brian King [Tue, 3 Feb 2009 00:39:40 +0000 (18:39 -0600)]
[SCSI] ibmvfc: Better handle other FC initiators

The ibmvfc driver currently always sets the role of all rports
to FC_PORT_ROLE_FCP_TARGET, which is not correct for other initiators.
This can cause problems if other initiators are on the fabric
when we then try to scan the rport for LUNs. Fix this by looking
at the service parameters returned in the PRLI to set the roles
appropriately. Also look at the returned service parameters to
decide whether or not we were actually able to successfully log into
the target.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi_dh_rdac: Retry for Quiescence in Progress in rdac device handler
Chauhan, Vijay [Mon, 26 Jan 2009 15:59:37 +0000 (21:29 +0530)]
[SCSI] scsi_dh_rdac: Retry for Quiescence in Progress in rdac device handler

During device discovery read capacity fails with 0x068b02 and sets the
device size to 0. As a reason any I/O submitted to this path gets
killed at sd_prep_fn with BLKPREP_KILL. This patch is to retry for
0x068b02

Signed-off-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Acked-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ipr: add message to error table
Wayne Boyer [Wed, 28 Jan 2009 16:24:50 +0000 (08:24 -0800)]
[SCSI] ipr: add message to error table

Adds a message to the error table for an error that wasn't previously handled.
In some cases the I/O Adapter will detect an error condition and mark a block
as "logically bad".

Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi dh alua: handle report luns data changed in check sense callout
Ilgu Hong [Fri, 30 Jan 2009 23:00:11 +0000 (17:00 -0600)]
[SCSI] scsi dh alua: handle report luns data changed in check sense callout

When we switch controllers the Intel Multi-Flex reports
REPORTED_LUNS_DATA_HAS_CHANGED. This patch just has us
retry the command.

Signed-off-by: Ilgu Hong <ilgu.hong@promise.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi dh alua: add intel Multi-Flex device
Ilgu Hong [Fri, 30 Jan 2009 23:00:10 +0000 (17:00 -0600)]
[SCSI] scsi dh alua: add intel Multi-Flex device

This adds the Intel Multi-Flex device to scsi_dh_alua's
scsi_dh_devlist, so the module attaches to these devs.

Signed-off-by: Ilgu Hong <ilgu.hong@promise.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi dh alua: fix group id masking
Ilgu Hong [Fri, 30 Jan 2009 23:00:09 +0000 (17:00 -0600)]
[SCSI] scsi dh alua: fix group id masking

The buf[i] is a byte but we are only asking 4 bits off the
group_id. This patch has us take off a byte.

Signed-off-by: Ilgu Hong <ilgu.hong@promise.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] remove scsi_req_map_sg
FUJITA Tomonori [Sat, 13 Dec 2008 16:23:45 +0000 (01:23 +0900)]
[SCSI] remove scsi_req_map_sg

No one uses scsi_execute_async with data transfer now. We can remove
scsi_req_map_sg.

Only scsi_eh_lock_door uses scsi_execute_async. scsi_eh_lock_door
doesn't handle sense and the callback. So we can remove
scsi_io_context too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osst: replace scsi_execute_async with the block layer API
FUJITA Tomonori [Sat, 13 Dec 2008 15:55:18 +0000 (00:55 +0900)]
[SCSI] osst: replace scsi_execute_async with the block layer API

This replaces scsi_execute_async with the block layer API. st does the
same thing so it might make sense to have something like libst (there
are other things that os and osst can share).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Willem Riede <osst@riede.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osst: make all the buffer the same size
FUJITA Tomonori [Sat, 13 Dec 2008 15:55:17 +0000 (00:55 +0900)]
[SCSI] osst: make all the buffer the same size

This simiplifies the buffer management; all the buffers in osst_buffer
become the same size. This is necessary to use the block layer API (sg
driver was modified in the same way) since the block layer API takes
the same size page frames instead of scatter gatter.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Willem Riede <osst@riede.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi: Add osd library to build system
Boaz Harrosh [Sun, 25 Jan 2009 15:24:14 +0000 (17:24 +0200)]
[SCSI] scsi: Add osd library to build system

OSD in kernel source code is assumed to be at:
drivers/scsi/osd/ with its own Makefile and Kconfig

Add includes to them from drivers/scsi Makefile and Kconfig
Add OSD to MAINTAINERS file

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osd: Kconfig file for in-tree builds
Boaz Harrosh [Sun, 25 Jan 2009 15:22:52 +0000 (17:22 +0200)]
[SCSI] osd: Kconfig file for in-tree builds

Kconfig file for the drivers/scsi/osd subdirectory.
Adds the following config items:
config SCSI_OSD_INITIATOR
config SCSI_OSD_ULD
config SCSI_OSD_DPRINT_SENSE
config SCSI_OSD_DEBUG

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osd: Documentation for OSD library
Boaz Harrosh [Sun, 25 Jan 2009 15:21:40 +0000 (17:21 +0200)]
[SCSI] osd: Documentation for OSD library

Add osd.txt to Documentation/scsi/

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: SCSI/OSD Sense decoding support
Boaz Harrosh [Sun, 25 Jan 2009 15:15:16 +0000 (17:15 +0200)]
[SCSI] libosd: SCSI/OSD Sense decoding support

Implementation of the osd_req_decode_sense() API. Can be called by
library users to decode what failed in command executions.

Add SCSI_OSD_DPRINT_SENSE Kconfig variable. Possible values are:
0 - Do not print any errors to messages file <KERN_ERR>
1 - (Default) Print only decoded errors that are not recoverable.
    Recoverable errors are those that the target has complied with
    the request but with a warning. For example read passed end of
    object will return zeros after the last valid byte.
2- Print all errors.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: OSDv2 auto detection
Boaz Harrosh [Sun, 25 Jan 2009 15:13:38 +0000 (17:13 +0200)]
[SCSI] libosd: OSDv2 auto detection

Auto detect an OSDv2 or OSDv1 target at run time. Note how none
of the OSD API calls change. The tests do not know what device
version it is.

This test now passes against both the IBM-OSD-SIM OSD1 target
as well as OSC's OSD2 target.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: OSD version 2 Support
Boaz Harrosh [Sun, 25 Jan 2009 15:09:40 +0000 (17:09 +0200)]
[SCSI] libosd: OSD version 2 Support

Add support for OSD2 at run time. It is now possible to run with
both OSDv1 and OSDv2 targets at the same time. The actual detection
should be preformed by the security manager, as the version is encoded
in the capability structure.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: Not implemented commands
Boaz Harrosh [Sun, 25 Jan 2009 15:07:14 +0000 (17:07 +0200)]
[SCSI] libosd: Not implemented commands

Some commands declared in header are not yet implemented. Put them
as stubs in .c file, just so they take their place in the file

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: Add Flush and List-objects support
Boaz Harrosh [Sun, 25 Jan 2009 15:05:07 +0000 (17:05 +0200)]
[SCSI] libosd: Add Flush and List-objects support

Add support for the various List-objects commands. List-partitions-in-device,
List-collections-in-partition, List-objects-in-partition,
List-objects-in-collection. All these support partial listing and continuation.

Add support for the different Flush commands and options.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: OSD Security processing stubs
Boaz Harrosh [Sun, 25 Jan 2009 15:03:07 +0000 (17:03 +0200)]
[SCSI] libosd: OSD Security processing stubs

Layout the signing of OSD's CDB and all-data security modes. The actual
code for signing the data and CDB is missing, but the code flow and the extra
buffer segments are all in place.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: attributes Support
Boaz Harrosh [Sun, 25 Jan 2009 14:59:50 +0000 (16:59 +0200)]
[SCSI] libosd: attributes Support

Support for both List-Mode and Page-Mode osd attributes. One of
these operations may be added to most other operations.

Define the OSD standard's attribute pages constants and structures
(osd_attributes.h)

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osd_uld: API for retrieving osd devices from Kernel
Boaz Harrosh [Sun, 25 Jan 2009 14:58:03 +0000 (16:58 +0200)]
[SCSI] osd_uld: API for retrieving osd devices from Kernel

Kernel clients like exofs can retrieve struct osd_dev(s)
by means of below API.

+ osduld_path_lookup() - given a path (e.g "/dev/osd0") locks and
returns the corresponding struct osd_dev, which is then needed
for subsequent libosd use.

+ osduld_put_device() - free up use of an osd_dev.

Devices can be shared by multiple clients. The osd_uld_device's
life time is governed by an embedded kref structure.

The osd_uld_device holds an extra reference to both it's
char-device and it's scsi_device, and will release these just
before the final deallocation.

There are three possible lock sources of the osd_uld_device
1. First and for most is the probe() function called by
  scsi-ml upon a successful login into a target. Released in release()
  when logout.
2. Second by user-mode file handles opened on the char-dev.
3. Third is here by Kernel users.
All three locks must be removed before the osd_uld_device is freed.

The MODULE has three lock sources as well:
1. scsi-ml at probe() time, removed after release(). (login/logout)
2. The user-mode file handles open/close.
3. Import symbols by client modules like exofs.

TODO:
  This API is not enough for the pNFS-objects LD. A more versatile
  API will be needed. Proposed API could be:
  struct osd_dev *osduld_sysid_lookup(const char id[OSD_SYSTEMID_LEN]);

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osd_uld: OSD scsi ULD
Boaz Harrosh [Sun, 25 Jan 2009 14:56:47 +0000 (16:56 +0200)]
[SCSI] osd_uld: OSD scsi ULD

Add a Linux driver module that registers as a SCSI ULD and probes
for OSD type SCSI devices.

When an OSD-type SCSI device is found a character device is created
in the form of /dev/osdX - where X goes from 0 up to hard coded 64.
The Major character device number used is 260.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: OSDv1 preliminary implementation
Boaz Harrosh [Sun, 25 Jan 2009 14:55:30 +0000 (16:55 +0200)]
[SCSI] libosd: OSDv1 preliminary implementation

Implementation of the most basic OSD functionality and
infrastructure. Mainly Format, Create/Remove Partition,
Create/Remove Object, and read/write.

- Add Makefile and Kbuild to compile libosd.ko
- osd_initiator.c Implementation file for osd_initiator.h
  and osd_sec.h APIs
- osd_debug.h - Some kprintf macro definitions

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libosd: OSDv1 Headers
Boaz Harrosh [Sun, 25 Jan 2009 14:54:10 +0000 (16:54 +0200)]
[SCSI] libosd: OSDv1 Headers

Headers only patch.

osd_protocol.h
Contains a C-fied definition of the T10 OSD standard
osd_types.h
Contains CPU order common used types
osd_initiator.h
API definition of the osd_initiator library
osd_sec.h
Contains High level API for the security manager.

[Note that checkpatch spews errors on things that are valid in this context
and will not be fixed]

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Reviewed-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] add OSD_TYPE
Boaz Harrosh [Sun, 25 Jan 2009 14:51:33 +0000 (16:51 +0200)]
[SCSI] add OSD_TYPE

- Define the OSD_TYPE scsi device and let it show up in scans

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] major.h: char-major number for OSD device driver
Boaz Harrosh [Sun, 25 Jan 2009 14:50:02 +0000 (16:50 +0200)]
[SCSI] major.h: char-major number for OSD device driver

Allocate major 260 for osd.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
CC: Torben Mathiasen <device@lanana.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: fix races with ioctl(SG_IO)
Tony Battersby [Tue, 20 Jan 2009 22:00:09 +0000 (17:00 -0500)]
[SCSI] sg: fix races with ioctl(SG_IO)

sg_io_owned needs to be set before the command is sent to the midlevel;
otherwise, a quickly-completing command may cause a different CPU
to see "srp->done == 1 && !srp->sg_io_owned", which would lead to
incorrect behavior.

Check srp->done and set srp->orphan while holding rq_list_lock to
prevent races with sg_rq_end_io().

There is no need to check sfp->closed from read/write/ioctl/poll/etc.
since the kernel guarantees that this won't happen.

The usefulness of sg_srp_done() was questionable before; now it is
definitely not needed.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sg: fix races during device removal
Tony Battersby [Wed, 21 Jan 2009 19:45:50 +0000 (14:45 -0500)]
[SCSI] sg: fix races during device removal

sg has the following problems related to device removal:

* opening a sg fd races with removing a device
* closing a sg fd races with removing a device
* /proc/scsi/sg/* access races with removing a device
* command completion races with removing a device
* command completion races with closing a sg fd
* can rmmod sg with active commands

These problems can cause kernel oopses, memory-use-after-free, or
double-free errors.  This patch fixes these problems by using krefs
to manage the lifetime of sg_device and sg_fd.

Each command submitted to the midlevel holds a reference to sg_fd
until the completion callback.  This ensures that sg_fd doesn't go
away if the fd is closed with commands still outstanding.

sg_fd gets the reference of sg_device (with scsi_device) and also
makes sure that the sg module doesn't go away.

/proc/scsi/sg/* functions don't play nicely with krefs because they
give information about sg_fds which have been closed but not yet
freed due to still having outstanding commands and sg_devices which
have been removed but not yet freed due to still being referenced
by one or more sg_fds.  To deal with this safely without removing
functionality, /proc functions now access sg_device and sg_fd while
holding a lock instead of using kref_get()/kref_put().

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] stex: Version update
Ed Lin - PTU [Mon, 26 Jan 2009 10:42:11 +0000 (02:42 -0800)]
[SCSI] stex: Version update

Update version to 4.6.0000.1

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>