pandora-kernel.git
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>
15 years ago[SCSI] ses: Use new scsi VPD helper
Matthew Wilcox [Wed, 31 Dec 2008 19:11:17 +0000 (12:11 -0700)]
[SCSI] ses: Use new scsi VPD helper

SES had its own code to retrieve VPD from devices; convert it to use the
new scsi_get_vpd_page helper.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] Add VPD helper
Matthew Wilcox [Wed, 31 Dec 2008 18:12:46 +0000 (13:12 -0500)]
[SCSI] Add VPD helper

Based on prior work by Martin Petersen and James Bottomley, this patch
adds a generic helper for retrieving VPD pages from SCSI devices.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Update version number to 8.03.00-k4.
Andrew Vasquez [Thu, 5 Mar 2009 19:07:05 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Update version number to 8.03.00-k4.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Correct overwrite of pre-assigned init-control-block structure size.
Andrew Vasquez [Thu, 5 Mar 2009 19:07:04 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Correct overwrite of pre-assigned init-control-block structure size.

The value is already pre-assigned prior to the qla2x00_mem_alloc().

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Correct truncation in return-code status checking.
Andrew Vasquez [Thu, 5 Mar 2009 19:07:03 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Correct truncation in return-code status checking.

QLA_* return codes are 'int' in size.  There were still several
legacy check-points which assumed a return-code width of 8-bits.
This could cause incorrect assumptions of 'good' status if a
return of QLA_FUNCTION_TIMEOUT.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Correct vport delete bug.
Anirban Chakraborty [Thu, 5 Mar 2009 19:07:02 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Correct vport delete bug.

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Use correct value for max vport in LOOP topology.
Lalit Chandivade [Thu, 5 Mar 2009 19:07:01 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Use correct value for max vport in LOOP topology.

Use minimum value for max vport during firmware initialization in LOOP
topology. Using max vport value from get resource count in LOOP topology
causes firmware initialization failure.

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] qla2xxx: Correct address range checking for option-rom updates.
Andrew Vasquez [Thu, 5 Mar 2009 19:07:00 +0000 (11:07 -0800)]
[SCSI] qla2xxx: Correct address range checking for option-rom updates.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: Change fcoe receive thread nice value from 19 (lowest priority) to -20
Robert Love [Fri, 27 Feb 2009 18:56:38 +0000 (10:56 -0800)]
[SCSI] fcoe: Change fcoe receive thread nice value from 19 (lowest priority) to -20

This change makes the fcoe Rx threads have the same nice value
as lpfc and qla2xxx Rx threads.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: fix handling of pending queue, prevent out of order frames (v3)
Chris Leech [Fri, 27 Feb 2009 18:56:32 +0000 (10:56 -0800)]
[SCSI] fcoe: fix handling of pending queue, prevent out of order frames (v3)

In fcoe_check_wait_queue() the queue length could temporarily drop to 0,
before the last frame was successfully sent.  This resulted in out of order
data frames within a single sequence, leading to IO timeout errors.

This builds on the approach from Vasu Dev to only fix the queue management in
fcoe_check_wait_queue, where my first patch added locking to the transmit
path even when the pending queue was not in use.

This patch continues to use fcoe_pending_queue.qlen instead of introducing a
new length counter, but takes precautions to ensure it never drops to 0 before
the final frame in the queue has successfully been passed to the netdev qdisc
layer.  It also includes some cleanup of fcoe_check_wait_queue and removes the
fcoe_insert_wait_queue(_head) wrapper functions.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: Out of order tx frames was causing several check condition SCSI status
Vasu Dev [Fri, 27 Feb 2009 18:56:27 +0000 (10:56 -0800)]
[SCSI] fcoe: Out of order tx frames was causing several check condition SCSI status

frames followed by these errors in log.

[sdp] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
[sdp] Sense Key : Aborted Command [current]
[sdp] Add. Sense: Data phase error

This was causing some test apps to exit due to write failure under heavy
load.

This was due to a race around adding and removing tx frame skb in
fcoe_pending_queue, Chris Leech helped me to find that brief unlocking
period when pulling skb from fcoe_pending_queue in various contexts
(fcoe_watchdog and fcoe_xmit) and then adding skb back into fcoe_pending_queue
up on a failed fcoe_start_io could change skb/tx frame order in
fcoe_pending_queue. Thanks Chris.

This patch allows only single context to pull skb from fcoe_pending_queue
at any time to prevent above described ordering issue/race by use of
fcoe_pending_queue_active flag.

This patch simplified fcoe_watchdog with modified fcoe_check_wait_queue by
use of FCOE_LOW_QUEUE_DEPTH instead previously used several conditionals
to clear and set lp->qfull.

I think FCOE_MAX_QUEUE_DEPTH with FCOE_LOW_QUEUE_DEPTH  will work better
in re/setting lp->qfull and these could be fine tuned for performance.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: fix kfree(skb)
Roel Kluin [Fri, 27 Feb 2009 18:56:22 +0000 (10:56 -0800)]
[SCSI] fcoe: fix kfree(skb)

Use kfree_skb instead of kfree for struct sk_buff pointers.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: ETH_P_8021Q is already in if_ether and fcoe is not using it anyway
Yi Zou [Fri, 27 Feb 2009 18:56:16 +0000 (10:56 -0800)]
[SCSI] fcoe: ETH_P_8021Q is already in if_ether and fcoe is not using it anyway

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: do not change the fh_rx_id of a recevied frame
Yi Zou [Fri, 27 Feb 2009 18:56:11 +0000 (10:56 -0800)]
[SCSI] libfc: do not change the fh_rx_id of a recevied frame

We shouldn't be altering inbound frames.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: Correct fcoe_transports initialization vs. registration
Robert Love [Fri, 27 Feb 2009 18:56:06 +0000 (10:56 -0800)]
[SCSI] fcoe: Correct fcoe_transports initialization vs. registration

The registration function shouldn't initialize the mutex or
list head. The fcoe SW transport should initialize itself
before registering.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fcoe: Use setup_timer() and mod_timer()
Robert Love [Fri, 27 Feb 2009 18:56:00 +0000 (10:56 -0800)]
[SCSI] fcoe: Use setup_timer() and mod_timer()

Use helper functions for watchdog timer setup.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc, fcoe: Remove unnecessary cast by removing inline wrapper
Robert Love [Fri, 27 Feb 2009 18:55:55 +0000 (10:55 -0800)]
[SCSI] libfc, fcoe: Remove unnecessary cast by removing inline wrapper

Comment from "Andrew Morton <akpm@linux-foundation.org>"

> +{
> +     return (struct fcoe_softc *)lport_priv(lp);

unneeded/undesirable cast of void*.  There are probably zillions of
instances of this - there always are.

This whole inline function was unnecessary. The FCoE layer knows
that it's data structure is stored in the lport private data, it
can just access it from lport_priv().

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc, fcoe: Cleanup function formatting and minor typos
Robert Love [Fri, 27 Feb 2009 18:55:50 +0000 (10:55 -0800)]
[SCSI] libfc, fcoe: Cleanup function formatting and minor typos

1) There were a few functions with a strange layout, i.e. all
   arguments on the second line, when not necessary.

   Where ever possible I moved the return value to the same line
   as the function name. However, when the line was too long
   to have a single argument on the same line I moved the
   return value to above line. For example:

   <short return> <function name>(<arg 1>, <arg2>)

   and

   <very long return value>
   <function name>(<arg1>,
   <arg2>)

2) Removed one extra whitespace line

3) Fixed two typos

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc, fcoe: Fix kerneldoc comments
Robert Love [Fri, 27 Feb 2009 18:55:45 +0000 (10:55 -0800)]
[SCSI] libfc, fcoe: Fix kerneldoc comments

1) Added '()' for function names in kerneldoc comments

2) Changed comment bookends from '**/' to '*/'. The comment on the the
   mailing list was that '**/' "is consistently unconventional.  Not
   wrong, just odd." The Documentation/kernel-doc-nano-HOWTO.txt
   states that kerneldoc comment blocks should end with '**/' but most
   (if not all) instance I found under drivers/scsi/ were only using
   the '*/' so I converted to that style.

3) Removed incorrect linebreaks in kerneldoc comments where found

4) Removed a few unnecessary blank comment lines in kerneldoc comment
   blocks

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: Cleanup libfc_function_template comments
Robert Love [Fri, 27 Feb 2009 18:55:39 +0000 (10:55 -0800)]
[SCSI] libfc: Cleanup libfc_function_template comments

Made the comments more like the comments for struct scsi_host_template.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: check for err when recv and state is incorrect
Robert Love [Fri, 27 Feb 2009 18:55:34 +0000 (10:55 -0800)]
[SCSI] libfc: check for err when recv and state is incorrect

If we've just created an interface and the an rport is
logging in we may have a request on the wire (say PRLI).
If we destroy the interface, we'll go through each rport
on the disc->rports list and set each rport's state to NONE.
Then the lport will reset the EM. The EM reset will send a
CLOSED event to the prli_resp() handler which will notice
that the state != PRLI. In this case it frees the frame
pointer, decrements the refcount and unlocks the rport.

The problem is that there isn't a frame in this case. It's
just a pointer with an embedded error code. The free causes
an Oops.

This patch moves the error checking to be before the state
checking.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: rename rp to rdata in fc_disc_new_target()
Robert Love [Fri, 27 Feb 2009 18:55:29 +0000 (10:55 -0800)]
[SCSI] libfc: rename rp to rdata in fc_disc_new_target()

Just rename the variable as per our naming convention.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: correct RPORT_TO_PRIV usage
Robert Love [Fri, 27 Feb 2009 18:55:23 +0000 (10:55 -0800)]
[SCSI] libfc: correct RPORT_TO_PRIV usage

We only need to use this macro when assigning a value to
rport->dd_data. All other accesses should just use dd_data.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: Don't violate transport template for rogue port creation
Robert Love [Fri, 27 Feb 2009 18:55:18 +0000 (10:55 -0800)]
[SCSI] libfc: Don't violate transport template for rogue port creation

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: exch mgr is freed while lport still retrying sequences
Steve Ma [Fri, 27 Feb 2009 18:55:13 +0000 (10:55 -0800)]
[SCSI] libfc: exch mgr is freed while lport still retrying sequences

When a sequence cannot be delivered to the target, the local
port will schedule retries, While this process is in progress,
if we destroy the FCoE interface, the fcoe_sw_destroy routine is
entered, and the fc_exch_mgr_free(lp->emp) is called.  Thus
if fc_exch_alloc() is called when retrying the sequence,
the mempool_alloc() will fail to allocate the exchange because
the mempool of the exchange manager has already been released.
This patch is to cancel any pending retry work of the local
port before we start to destroy the interface.

Also, when resetting the local port, we should also stop the
scheduled pending retries.

Signed-off-by: Steve Ma <steve.ma@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: fixed a read IO data integrity issue when a IO data frame lost
Vasu Dev [Fri, 27 Feb 2009 18:55:07 +0000 (10:55 -0800)]
[SCSI] libfc: fixed a read IO data integrity issue when a IO data frame lost

The fc_fcp_complete_locked detected data underrun in this case and set
the FC_DATA_UNDRUN but that was ignored by fc_io_compl for all cases
including read underrun.

Added code to not to ignore FC_DATA_UNDRUN for read IO and instead
suggested scsi-ml to retry cmd to  recover from lost data frame.

Not sure if it is okay to ignore FC_DATA_UNDRUN for other case, so let
code as is for other cases but removed or-ing with zero valued fsp->cdb_status
for those cases.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: rport retry on LS_RJT from certain ELS
Chris Leech [Fri, 27 Feb 2009 18:55:02 +0000 (10:55 -0800)]
[SCSI] libfc: rport retry on LS_RJT from certain ELS

This allows any rport ELS to retry on LS_RJT.

The rport error handling would only retry on resource allocation failures
and exchange timeouts.  I have a target that will occasionally reject PLOGI
when we do a quick LOGO/PLOGI.  When a critical ELS was rejected, libfc would
fail silently leaving the rport in a dead state.

The retry count and delay are managed by fc_rport_error_retry.  If the retry
count is exceeded fc_rport_error will be called.  When retrying is not the
correct course of action, fc_rport_error can be called directly.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status
Vasu Dev [Fri, 27 Feb 2009 18:54:57 +0000 (10:54 -0800)]
[SCSI] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status

The fcoe_xmit could call fc_pause in case the pending skb queue len is larger
than FCOE_MAX_QUEUE_DEPTH, the fc_pause was trying to grab lport->lp_muex to
change lport->link_status and that had these issues :-

1. The fcoe_xmit was getting called with bh disabled, thus causing
"BUG: scheduling while atomic" when grabbing lport->lp_muex with bh disabled.

2. fc_linkup and fc_linkdown function calls lport_enter function with
lport->lp_mutex held and these enter function in turn calls fcoe_xmit to send
lport related FC frame, e.g. fc_linkup => fc_lport_enter_flogi to send flogi
req. In this case grabbing the same lport->lp_mutex again in fc_puase from
fcoe_xmit would cause deadlock.

The lport->lp_mutex was used for setting FC_PAUSE in fcoe_xmit path but
FC_PAUSE bit was not used anywhere beside just setting and clear this
bit in lport->link_status, instead used a separate field qfull in fc_lport
to eliminate need for lport->lp_mutex to track pending queue full condition
and in turn avoid above described two locking issues.

Also added check for lp->qfull in fc_fcp_lport_queue_ready to trigger
SCSI_MLQUEUE_HOST_BUSY when lp->qfull is set to prevent more scsi-ml cmds
while lp->qfull is set.

This patch eliminated FC_LINK_UP and FC_PAUSE and instead used dedicated
fields in fc_lport for this, this simplified all related conditional
code.

Also removed fc_pause and fc_unpause functions and instead used newly added
lport->qfull directly in fcoe.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: fixed a soft lockup issue in fc_exch_recv_abts
Vasu Dev [Fri, 27 Feb 2009 18:54:51 +0000 (10:54 -0800)]
[SCSI] libfc: fixed a soft lockup issue in fc_exch_recv_abts

The fc_seq_start_next grabs ep->ex_lock but this lock was already held here,
so instead called fc_seq_start_next_locked to avoid soft lockup.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: handle RRQ exch timeout
Vasu Dev [Fri, 27 Feb 2009 18:54:46 +0000 (10:54 -0800)]
[SCSI] libfc: handle RRQ exch timeout

Cleanup exchange held due to RRQ when RRQ exch times out, in this case the
ABTS is already done causing RRQ req therefore proceeding with cleanup in
fc_exch_rrq_resp should be okay to restore exch resource.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: when rport goes away (re-plogi), clean up exchanges to/from rport
Abhijeet Joglekar [Fri, 27 Feb 2009 18:54:41 +0000 (10:54 -0800)]
[SCSI] libfc: when rport goes away (re-plogi), clean up exchanges to/from rport

When a rport goes away, libFC does a plogi which will reset exchanges
    at the rport. Clean exchanges at our end, both in transport and libFC.
    If transport hooks into exch_mgr_reset, it will call back into
    fc_exch_mgr_reset() to clean up libFC exchanges.

Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] libfc: Pass lport in exch_mgr_reset
Abhijeet Joglekar [Fri, 27 Feb 2009 18:54:35 +0000 (10:54 -0800)]
[SCSI] libfc: Pass lport in exch_mgr_reset

fc_exch_mgr structure is private to fc_exch.c. To export exch_mgr_reset to
transport, transport needs access to the exch manager. Change
exch_mgr_reset to use lport param which is the shared structure between
libFC and transport.

Alternatively, fc_exch_mgr definition can be moved to libfc.h so that lport
can be accessed from mp*.

Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] sd: Don't try to spin up drives that are connected to an inactive port
Matthew Wilcox [Fri, 20 Feb 2009 13:53:48 +0000 (06:53 -0700)]
[SCSI] sd: Don't try to spin up drives that are connected to an inactive port

We currently try to spin up drives connected to standby and unavailable
ports.  This will never succeed and wastes a lot of time.  Fail quickly
if the sense data reports the port is in standby or unavailable state.

Reported-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com>
Tested-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Wed, 4 Mar 2009 15:49:07 +0000 (07:49 -0800)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc: Run sbc610 USB fixup code only on the appropriate platform.

15 years agodrm: fix double lock typo
Helge Bahmann [Wed, 4 Mar 2009 11:49:14 +0000 (21:49 +1000)]
drm: fix double lock typo

[airlied: you shall not retype patches from other trees half asleep]

Signed-of-by: Dave Airlie <airlied@redhat.com>
15 years agopowerpc: Run sbc610 USB fixup code only on the appropriate platform.
Tony Breeds [Tue, 3 Mar 2009 17:59:30 +0000 (17:59 +0000)]
powerpc: Run sbc610 USB fixup code only on the appropriate platform.

commit a969e76a7101bf5f3d369563df1ca1253dd6131b (powerpc: Correct USB
support for GE Fanuc SBC610) introduced a fixup for NEC usb controllers.
This fixup should only run on GEF SBC610 boards.

Fixes Fedora bug #486511.
(https://bugzilla.redhat.com/show_bug.cgi?id=486511)

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 years agoLinux 2.6.29-rc7 v2.6.29-rc7
Linus Torvalds [Wed, 4 Mar 2009 01:05:22 +0000 (17:05 -0800)]
Linux 2.6.29-rc7

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Wed, 4 Mar 2009 01:05:08 +0000 (17:05 -0800)]
Merge git://git./linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: ixp4xx - Fix qmgr_request_queue build failure
  crypto: api - Fix module load deadlock with fallback algorithms

15 years agocrypto: ixp4xx - Fix qmgr_request_queue build failure
Krzysztof Hałasa [Wed, 4 Mar 2009 00:01:22 +0000 (08:01 +0800)]
crypto: ixp4xx - Fix qmgr_request_queue build failure

There is another user of IXP4xx queue manager, fix it.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
15 years agoMerge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Tue, 3 Mar 2009 22:33:20 +0000 (14:33 -0800)]
Merge branch 'sched-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sched: don't allow setuid to succeed if the user does not have rt bandwidth
  sched_rt: don't start timer when rt bandwidth disabled

15 years agoMerge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 3 Mar 2009 22:32:55 +0000 (14:32 -0800)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: oprofile: don't set counter width from cpuid on Core2
  x86: fix init_memory_mapping() to handle small ranges

15 years agoMerge branch 'tracing/mmiotrace' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 3 Mar 2009 22:32:37 +0000 (14:32 -0800)]
Merge branch 'tracing/mmiotrace' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'tracing/mmiotrace' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86 mmiotrace: fix race with release_kmmio_fault_page()
  x86 mmiotrace: improve handling of secondary faults
  x86 mmiotrace: split set_page_presence()
  x86 mmiotrace: fix save/restore page table state
  x86 mmiotrace: WARN_ONCE if dis/arming a page fails
  x86: add far read test to testmmiotrace
  x86: count errors in testmmiotrace.ko