]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
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>
15 years ago[SCSI] stex: Small fixes
Ed Lin - PTU [Mon, 26 Jan 2009 10:41:53 +0000 (02:41 -0800)]
[SCSI] stex: Small fixes

Some small fixes, including:
- add data direction in req_msg because new firmware version
  may require this (backward compatible)
- change internal timeout value
- change judgment of type st_vsc1
- blank line handling, etc.

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] stex: Fix for controller type st_yosemite
Ed Lin - PTU [Mon, 26 Jan 2009 10:40:50 +0000 (02:40 -0800)]
[SCSI] stex: Fix for controller type st_yosemite

This is the fix for controller type st_yosemite, including
- max_lun is 256 (backward compatible)
- remove unneeded special handling of INQUIRY
- remove unnecessary listing of sub device ids

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] stex: Add new device id
Ed Lin - PTU [Mon, 26 Jan 2009 10:40:29 +0000 (02:40 -0800)]
[SCSI] stex: Add new device id

Add new device id for controller type st_seq.

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] stex: Fix for potential invalid response
Ed Lin - PTU [Mon, 26 Jan 2009 10:40:11 +0000 (02:40 -0800)]
[SCSI] stex: Fix for potential invalid response

The interrupt routine is good for normal cases. However, if the firmware
is abnormal and returns an invalid response, the driver may reuse a
ccb structure that has already been handled. This may cause problem.
Fix this by setting the req member to NULL. Next time we know the
response is invalid and handle accordingly if req is NULL.

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] osst: Remove SUGGEST flags
James Bottomley [Sun, 25 Jan 2009 21:09:42 +0000 (15:09 -0600)]
[SCSI] osst: Remove SUGGEST flags

Fix up remaining bit of SUGGEST flag removal done by patch

commit 0f10274300857d98ea5ea4c800c561a9ad9ac89f
Author: Martin K. Petersen <martin.petersen@oracle.com>
Date:   Sun Jan 4 03:14:11 2009 -0500

    [SCSI] Remove SUGGEST flags

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] Remove SUGGEST flags
Martin K. Petersen [Sun, 4 Jan 2009 08:14:11 +0000 (03:14 -0500)]
[SCSI] Remove SUGGEST flags

The SUGGEST_* flags in the SCSI command result have been out of fashion
for a while and we don't actually use them in the error handling.
Remove the remaining occurrences.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] ipr: add MSI support
Wayne Boyer [Fri, 23 Jan 2009 17:17:35 +0000 (09:17 -0800)]
[SCSI] ipr: add MSI support

Enable MSI if available/supported.

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] scsi_transport_fc: Add missing parenthesis to Point-To-Point description
Christof Schmitt [Thu, 15 Jan 2009 15:51:48 +0000 (16:51 +0100)]
[SCSI] scsi_transport_fc: Add missing parenthesis to Point-To-Point description

Fix typo by adding closing parenthesis.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sym53c8xx: Keep transfer negotiations valid
Aaro Koskinen [Thu, 15 Jan 2009 15:13:36 +0000 (17:13 +0200)]
[SCSI] sym53c8xx: Keep transfer negotiations valid

(The patch updated based on testing and comments from Tony Battersby.)

Change the sym53c8xx_2 driver negotiation logic so that the driver will
tolerate better device removals. Negotiation message(s) will be sent
with every INQUIRY and REQUEST SENSE command, and whenever there is a
change in goals or when the device reports check condition.

The patch was made specifically to address the case where you hotswap
the disk using remove-single-device/add-single-device commands through
/proc/scsi/scsi. Without the patch the driver keeps using old transfer
parameters even though the target is reset and reports check condition,
so the data transfer of the very first INQUIRY will fail.

Signed-off-by: Aaro Koskinen <Aaro.Koskinen@nokia.com>
Tested-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] Improve SCSI_LOGGING Kconfig entry
Robert Love [Wed, 14 Jan 2009 19:14:32 +0000 (11:14 -0800)]
[SCSI] Improve SCSI_LOGGING Kconfig entry

The Kconfig entry for SCSI_LOGGING refers the reader to
drivers/scsi/scsi.c, but I didn't find any useful information
there. There is certainly logging code in that file, but the
logging types and logging levels are described in
drivers/scsi/scsi_logging.h.

Also, the procfs file referred to in the section is incorrect.
It should be /proc/sys/dev/scsi/logging_level and not
/proc/scsi/scsi.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] Check for deleted device in scsi_device_online()
Hannes Reinecke [Mon, 12 Jan 2009 08:28:55 +0000 (09:28 +0100)]
[SCSI] Check for deleted device in scsi_device_online()

scsi_device_online() is not just a negation of SDEV_OFFLINE,
also devices in state SDEV_DEL are actually offline.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] lpfc: constify virtual function tables
Jan Engelhardt [Sun, 11 Jan 2009 09:38:59 +0000 (10:38 +0100)]
[SCSI] lpfc: constify virtual function tables

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: fix compile warning
FUJITA Tomonori [Sun, 11 Jan 2009 08:38:12 +0000 (17:38 +0900)]
[SCSI] libfc: fix compile warning

I got the following warnings on IA64:

drivers/scsi/libfc/fc_lport.c: In function 'fc_lport_recv_flogi_req':
drivers/scsi/libfc/fc_lport.c:788: warning: format '%llx' expects type 'long long unsigned int', but argument 3 has type 'u64'
drivers/scsi/libfc/fc_lport.c:792: warning: format '%llx' expects type 'long long unsigned int', but argument 3 has type 'u64'
scsi/libfc/fc_rport.c: In function 'fc_rport_recv_plogi_req':
/home/fujita/git/linux-2.6/drivers/scsi/libfc/fc_rport.c:968: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64'

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: needs CRC32
Randy Dunlap [Mon, 12 Jan 2009 18:50:58 +0000 (10:50 -0800)]
[SCSI] libfc: needs CRC32

libfc uses crc32 functions, so cause it to be built
via select:

drivers/built-in.o: In function `fc_frame_crc_check':
(.text+0x75dae): undefined reference to `crc32_le'
drivers/built-in.o: In function `fc_fcp_recv':
fc_fcp.c:(.text+0x7b919): undefined reference to `crc32_le'
fc_fcp.c:(.text+0x7b9d5): undefined reference to `crc32_le'
fc_fcp.c:(.text+0x7ba54): undefined reference to `crc32_le'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi_debug: needs CRC_T10DIF
Randy Dunlap [Mon, 12 Jan 2009 18:53:04 +0000 (10:53 -0800)]
[SCSI] scsi_debug: needs CRC_T10DIF

Fix scsi_debug build error:

drivers/built-in.o: In function `resp_read':
scsi_debug.c:(.text+0x21379a): undefined reference to `crc_t10dif'
drivers/built-in.o: In function `resp_write':
scsi_debug.c:(.text+0x213fca): undefined reference to `crc_t10dif'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi_debug: DIF/DIX support
Martin K. Petersen [Sun, 4 Jan 2009 08:08:19 +0000 (03:08 -0500)]
[SCSI] scsi_debug: DIF/DIX support

This patch adds support for DIX and DIF in scsi_debug.  A separate
buffer is allocated for the protection information.

 - The dix parameter indicates whether the controller supports DIX
   (protection information DMA)

 - The dif parameter indicates whether the simulated storage device
   supports DIF

 - The guard parameter switches between T10 CRC(0) and IP checksum(1)

 - The ato parameter indicates whether the application tag is owned by
   the disk(0) or the OS(1)

 - DIF and DIX errors can be triggered using the scsi_debug_opts mask

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] scsi_sysfs: delete extra kernel-doc
Randy Dunlap [Fri, 9 Jan 2009 23:28:13 +0000 (15:28 -0800)]
[SCSI] scsi_sysfs: delete extra kernel-doc

Warning(linux-2.6.28-git13//drivers/scsi/scsi_sysfs.c:1049): Excess function parameter 'dev' description in 'scsi_sysfs_add_host'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>