dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

75559 Commits

Author SHA1 Message Date
Kai Makisara fd66c1b4e4 [SCSI] st: convert to unlocked_ioctl
Convert st to unlocked_ioctl. The necessary locking was already in place.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:29 -06:00
Salyzyn, Mark 8ce3eca4dc [SCSI] aacraid: remove pigs in space
I was amazed at how much embedded space was present in the aacraid
driver source files. Just selected five files from the set to clean up
for now and the attached patch swelled to 73K in size!

- Removed trailing space or tabs
- Removed spaces embedded within tabs
- Replaced leading 8 spaces with tabs
- Removed spaces before )
- Removed ClusterCommand as it was unused (noticed it as one triggered by above)
- Replaced scsi_status comparison with 0x02, to compare against SAM_STATUS_CHECK_CONDITION.
- Replaced a long series of spaces with tabs
- Replaced some simple if...defined() with ifdef/ifndef

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:28 -06:00
FUJITA Tomonori d07e03610c [SCSI] sg: handle class_device_create failure properly
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:28 -06:00
FUJITA Tomonori a24484f281 [SCSI] sg: set class_data after success
If cdev_add fails in sg_add, sg_remove crashes since class_data is
bogus.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:28 -06:00
Salyzyn, Mark d814c5173c [SCSI] dpt_i2o: use constant instead of bare value
0x02 becomes SAM_STAT_CHECK_CONDITION

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:28 -06:00
Mathieu Segaud f7fea185d2 [SCSI] ch: Convert to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs
with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl
member. It applies the same locking rationale than ch_ioctl_compat() uses
to ch_ioctl().

Signed-off-by: Mathieu Segaud <mathieu.segaud@regala.cx>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:28 -06:00
Andi Kleen eaa3e22e8d [SCSI] sg: Only print SCSI data direction warning once for a command
When I use cdparanoia my logs get spammed a lot by

printk: 464 messages suppressed.
sg_write: data in/out 30576/30576 bytes for SCSI command 0xbe--guessing data in;
   program cdparanoia not setting count and/or reply_len properly
printk: 1078 messages suppressed.

and many more of those. With this patch the message is only printed once
for a command in a row.

v1->v2: Prevent rate limit messages too (pointed out by jejb)

Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:27 -06:00
Alan Cox d496f94d22 [SCSI] aacraid: fix security weakness
Actually there are several but one is trivially fixed

1.	FSACTL_GET_NEXT_ADAPTER_FIB ioctl does not lock dev->fib_list
but needs to
2.	Ditto for FSACTL_CLOSE_GET_ADAPTER_FIB
3.	It is possible to construct an attack via the SRB ioctls where
the user obtains assorted elevated privileges. Various approaches are
possible, the trivial ones being things like writing to the raw media
via scsi commands and the swap image of other executing programs with
higher privileges.

So the ioctls should be CAP_SYS_RAWIO - at least all the FIB manipulating
ones. This is a bandaid fix for #3 but probably the ioctls should grow
their own capable checks. The other two bugs need someone competent in that
driver to fix them.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:27 -06:00
Salyzyn, Mark 3ace426f95 [SCSI] aacraid: replace '<?:' with min_t()
The promised min_t() cleanup. Purely cosmetic.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:27 -06:00
FUJITA Tomonori b80ca4f7ee [SCSI] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE
This replaces sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE in
several LLDs. It's a preparation for the future changes to remove
sense_buffer array in scsi_cmnd structure.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:27 -06:00
FUJITA Tomonori 94aa5e5f62 [SCSI] aic7xxx_old, eata_pio, ips, libsas: don't zero out sense_buffer in queuecommand
LLDs don't need to zero out scsi_cmnd::sense_buffer in queuecommand
since scsi-ml does. This is a preparation of the future changes to
allocate the sense_buffer only when necessary.

Many LLDs zero out the sense_buffer before touching it on the error
case. This patch lets them alone for now because new APIs for them
would be added later on.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: "Salyzyn, Mark" <Mark_Salyzyn@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:26 -06:00
Randy Dunlap 382db811a8 [SCSI] megaraid: fix section mismatch
Change megaraid_pci_driver_g variable name so that it matches the modpost
whitelist that allows pointers to init text/data.

WARNING: vmlinux.o(.data+0x1a8e30): Section mismatch: reference to .init.text:megaraid_probe_one (between 'megaraid_pci_driver_g' and 'class_device_attr_megaraid_mbox_app_hndl')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:26 -06:00
FUJITA Tomonori cc75e8ab6f [SCSI] libsas: fix sense_buffer overrun
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:26 -06:00
Salyzyn, Mark 3bc8070fb7 [SCSI] aacraid: SMC vendor identification
Due to an internal limit associated with the AdapterTypeText field,
SMC required a product ID that overloaded the combined vendor and
product ID. A decision was made to ship the SMC products without a
vendor string dropping the defacto space that used to delineate vendor
and product to boot. To correct this, we needed to adjust the code in
the driver to parse out the vendor and product strings for the
adapter. We match of 'AOC' in the AdapterTypeText, if so we set the
vendor to SMC and place the entire AdapterTypeText into the product
field.

This only affects the cosmetic presentation of the Adapter vendor and
product in the logs and in sysfs.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:26 -06:00
Salyzyn, Mark 0995ad382d [SCSI] aacraid: respond to enclosure service events
Added support to respond to enclosure service events
(controller AIFs) to add, online or offline physical targets
reported to sg. Also added online and offlining of arrays.
Removed an automatic variable definition in a sub block that
hid an earlier definition, determined to be inert as the
sub-block use did not interfere. Bumped the driver versioning
to stamp the addition of this feature.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:26 -06:00
Krzysztof Helt d9aa3af09c [SCSI] sym53c8xx: fixes two bugs related to chip reset
This patch fixes two bugs pointed by James Bottomley:

 1. the if (!sym_data->io_reset).  That variable is only ever filled
    by a stack based completion.  If we find it non empty it means
    this code has been entered twice and we have a severe problem,
    so that should just become a BUG_ON(sym_data->io_reset).
 2. sym_data->io_reset should be set to NULL before the routine is
    exited otherwise the PCI recovery code could end up completing
    what will be a bogus pointer into the stack.

Big thanks to James Bottomley for help with the patch.

Signed-off-by: Krzysztof Helt <krzysztof.h1@w.pl>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:25 -06:00
Salyzyn, Mark 3a0086a80a [SCSI] aacraid: add call to flush_kernel_dcache_page
Some architectures require a call to flush_kernel_dcache_page for
processor spoofed DMA operations.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:24 -06:00
Prakash, Sathya 984621b437 [SCSI] mpt fusion: Fix for module unload problem in flash less controller environment
This patch fixes the module unload problem in flash less 1030
controller environment where firmware download boot functionality is
invoked.  The problem is due to the firmware download is being done in
the reverse order, which this patch solves by insureing the download
occurs to the last controller being reset.

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:24 -06:00
James Smart 32cfe344b0 [SCSI] lpfc 8.2.4 : Update lpfc driver version to 8.2.4
Update lpfc driver version to 8.2.4

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:24 -06:00
James Smart fa4066b672 [SCSI] lpfc 8.2.4 : Rework misplaced reference taking on node structure
Rework misplaced reference taking on node structure

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:24 -06:00
James Smart c95d6c6c2b [SCSI] lpfc 8.2.4 : Enhance debugfs use
Enhance debugfs to dump HBA SLIM as well as Host SLIM

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:23 -06:00
James Smart 9c2face687 [SCSI] lpfc 8.2.4 : Fix Unsolicited Data items
Fix Drivers Unsolicited CT command handling - we did not handle multiframe
  sequences well.
Fix error due to delay in replenishing buffers for unsolicited data.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:23 -06:00
James Smart 83108bd382 [SCSI] lpfc 8.2.4 : Add additional sysfs and module parameters
Made link speed and link topology modifiable via sysfs
Make scatter gather Segment Count into a module parameter.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:23 -06:00
Tomohiro Kusumi 8a4df120b0 [SCSI] lpfc 8.2.4 : Make lpfc legacy I/O port free
This is a patch written by Tomohiro Kusumi and submitted to
linux-scsi:

http://marc.info/?l=linux-scsi&m=118673720712152&w=2

The original patch comment:

This patch makes Emulex lpfc driver legacy I/O port free.
It has already been acked quite long time ago.
So I resubmit the patch.
http://lkml.org/lkml/2006/11/22/28

Current lpfc driver is already using pci_select_bars()
and pci_enable_device_bars() when the PCI bus has been reset.
So I think this patch should also be acked.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:23 -06:00
James Smart 0937282036 [SCSI] lpfc 8.2.4 : Miscellaneous Fixes
Miscellaneous Fixes:
- Fix a couple of sparse complaints
- Reset the FCP recovery flag when the node is not a FCP2 device.
- Speed up offline prep delays
- Fixed a memory leak in lpfc_mem_alloc failure path
- Fixed external loopback test.
- Fixed error code returned from the driver when HBA is over heated.
- Correct Max NPIV vport to limits read from adapter
- Add missing locks around fc_flag and FC_NEEDS_REG_VPI
- Add missing hba ids for device identification
- Added support for SET_VARIABLE and MBX_WRITE_WWN mailbox commands
- Changed all temperature event messages from warning to error
- Fix reporting of link speed when link is down
- Added support for MBX_WRITE_WWN mailbox command
- Change del_timer_sync() in ISR to del_timer() in interrupt handler
- Correct instances of beXX_to_cpu() that should be cpu_to_beXX()
- Perform target flush before releasing node references on module unload
- Avoid bogus devloss_tmo messages when driver unloads
- Fix panic when HBA generates ERATT interupt
- Fix mbox race condition and a workaround on back-to-back mailbox commands
- Force NPIV off for pt2pt mode between 2 NPorts
- Stop worker thread before removing fc_host.
- Fix up discovery timeout error case due to missing clear_la
- Tighten mailbox polling code to speed up detection of fast completions
- Only allow DUMP_MEMORY if adapter offline due to overtemp errors
- Added extended error information to the log messages in chip init.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:22 -06:00
James Smart 13815c8344 [SCSI] lpfc 8.2.4 : Add parameters to enable and disable heartbeat and hba resets
Add parameters to enable and disable heartbeat and hba resets

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:22 -06:00
James Smart fa61a54e48 [SCSI] lpfc 8.2.4 : Correct abort handler logic
Correct Abort handler logic. It was unconditionally waiting a minimum
of 2 seconds rather than looking for abort completion.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:21 -06:00
James Smart 0ff10d46cf [SCSI] lpfc 8.2.4 : Miscellaneous Discovery/ELS Fixes
Miscellaneous Discovery/ELS Fixes:
- Delay free's of ELS requests if adapter reject conditions
- Fix concurrent PLOGI vs ADISC state handling
- Add retry mechanism for GFF_ID
- Correct some illegal state transitions around RSCN timeouts
- Fix missing return in FAN handling

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:21 -06:00
Salyzyn, Mark b18268fc63 [SCSI] aacraid: improve queue balancing
The adapter queue is divided up equally to all the arrays to prevent
command starvation to any individual array. On the other hand,
physical targets are only granted a queue depth of one each. The code
prior to this patch used to deal with the incremental discovery of
targets, but the driver knows how many arrays are present prior to the
scan so this knowledge is used to generate a better estimate for the
queue depth.

Remove the capability of 'physical=0' from preventing access to the
class of adapters that have the RAID/SCSI mode of operation since none
of the physicals on the SCSI channel are candidates ever for an array.

As always, the user can override this default queue depth policy by
making the appropriate adjustments utilizing sysfs.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:21 -06:00
Salyzyn, Mark b6ef70f33c [SCSI] aacraid: OS panic after Adapter panic (hardening).
In experiments in the lab we managed to trigger an Adapter firmware
panic (BlinkLED) coincidentally while several pass-through ioctl
command from the management software were outstanding on a bug only
present on a class of RAID Adapters that require a hardware reset
rather than a commanded reset. The net result was an attempt to time
out the management software command as if it came from the SCSI layer
resulting in an OS panic.

Adapters that use commanded reset, management commands are returned
failed by the Adapter correctly. The adapter firmware panic that
resulted in this condition was also resolved, and there were no
adapters in the field with this specific firmware bug so we do not
expect any field reports. This is a rare or unlikely corner condition,
and no reports have ever been forwarded from the field.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:21 -06:00
Salyzyn, Mark 6dcd4a7fe5 [SCSI] aacraid: fix multiple definition of automatic variable warning.
The 'entry' automatic variable was defined at the top and within a
block that uses it, removed the definition from the block that uses
it. Some cosmetic changes were made while in the same file. This patch
should be inert.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:20 -06:00
Salyzyn, Mark a3940da5e6 [SCSI] aacraid: fix big endian issues
Big endian systems issues discovered in the aacraid driver. Somewhat
reverses a patch from November 7th of last year that removed swap
operations because they formerly were being assigned to an u8 array
when they should have been assigned to an le32 array.

This patch is largely inert for any little endian processor
architecture. It resolves a bug in delivering the BlinkLED AIF event
to registered applications when the adapter or associated hardware was
reset due to ill health. A rare corner case occurrence, also largely
unnoticed by any as it was a new (untested!) feature.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:19 -06:00
Salyzyn, Mark 06a43d1725 [SCSI] aacraid: variable redefinition hides earlier warning
The parameter 'info' is reused, renamed the second to sinfo to
represent supplemental adapter info, to suppress compile warning
message.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:19 -06:00
Salyzyn, Mark 17eaaceef5 [SCSI] aacraid: add sysfs report of RAID level
Report the RAID level string for the SCSI device representing the
array. Report is in /sys/class/scsi_device/#:#:#:#/device/level.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:19 -06:00
Salyzyn, Mark 95e852e1ef [SCSI] aacraid: add parameter to control FUA and SYNCHRONIZE_CACHE policy
aacraid.cache parameter, Disable Queue Flush commands:
        bit 0 - Disable FUA in WRITE SCSI commands
        bit 1 - Disable SYNCHRONIZE_CACHE SCSI command
        bit 2 - Disable only if Battery not protecting adapter supplied Cache

e.g.: aacraid.cache=7 will disable the FUA and SYNCHRONIZE_CACHE
commands if the adapter has reported that it's cache is battery backed
up.

This parameter permits experimentation with tradeoffs between
performance and caching policy.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:18 -06:00
James Bottomley 9b161a4d3e [SCSI] scsi_transport_spi: convert to attribute groups
This conversion makes full use of the is_visible() callback on attribute
groups.  Now, each device appears only with its capability flags in the
transport class directory.  Previously each device appeared with the
capability of the host, so this is a functionality improvement.
Converting to attribute groups allows us to sweep away most of the home
grown #defines that were effectively doing the same thing.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:18 -06:00
James Bottomley d4acd722b7 [SCSI] sysfs: add filter function to groups
This patch allows the various users of attribute_groups to selectively
allow the appearance of group attributes.  The primary consumer of
this will be the transport classes in which we currently have
elaborate attribute selection algorithms to do this same thing.

Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:18 -06:00
James Bottomley d52b3815a5 [SCSI] add missing transport configure points for target and host
While trying to convert the SPI transport class to attribute groups, I
discovered that we don't actually have any transport configure points
for either the target or the host.  This patch adds these missing
transport class triggers.  The host one is simply done after the add,
the target one tries to be more clever and add it after devices may have
been placed on the target (so the device configure will have set up the
target parameters).

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:17 -06:00
James Bottomley fd1109711d [SCSI] attribute_container: update to use the group interface
This patch is the beginning of moving the attribute_containers to use
attribute groups exclusively.  The attr element is now deprecated and
will eventually be removed (along with all the hand rolled code for
doing exactly what attribute groups do) when all the consumers are
converted to attribute groups.

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:17 -06:00
James Bottomley 11f24fbdf5 [SCSI] sysfs: fix the sysfs_add_file_to_group interfaces
I can't see a reason why these shouldn't work on every group.  However,
they only seem to work on named groups.  This patch allows the group
functions to work on anonymous groups (those with NULL names).

Acked-by: Tejun Heo <htejun@gmail.com>
Acked-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:29:17 -06:00
James Bottomley d0ad3bc97c [SCSI] libata: fix corruption induced by relaxed DMA alignment in SCSI
Hugh Dickens noticed that SMART commands issued from user space can
end up corupting memory.  The problem occurs if the buffer used to
read data spans two pages.  The reason is that the PIO sector routines
in libata are expecting physically contiguous pages when they do
sector operations, so the left overs on the second page go into the
next physically adjacent page rather than the next page in the sg
mapping.

Fix this by enforcing strict 512 byte alignment on all buffers from
userspace.

Acked-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-23 11:27:54 -06:00
James Bottomley 465ff3185e [SCSI] relax scsi dma alignment
This patch relaxes the default SCSI DMA alignment from 512 bytes to 4
bytes.  I remember from previous discussions that usb and firewire have
sector size alignment requirements, so I upped their alignments in the
respective slave allocs.

The reason for doing this is so that we don't get such a huge amount of
copy overhead in bio_copy_user() for udev.  (basically all inquiries it
issues can now be directly mapped).

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:22 -06:00
James Bottomley 11c3e689f1 [SCSI] block: Introduce new blk_queue_update_dma_alignment interface
The purpose of this is to allow stacked alignment settings, with the
ultimate queue alignment being set to the largest alignment requirement
in the stack.

The reason for this is so that the SCSI mid-layer can relax the default
alignment requirements (which are basically causing a lot of superfluous
copying to go on in the SG_IO interface) while allowing transports,
devices or HBAs to add stricter limits if they need them.

Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:20 -06:00
FUJITA Tomonori 166a72878f [SCSI] fix scsi_setup_command_freelist failure path race
Looks like that host_cmd_pool_mutex are necessary here.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:18 -06:00
James Bottomley 210ba1d172 [SCSI] sr: update to follow tray status correctly
Based on an original patch from: David Martin <tasio@tasio.net>

When trying to get the drive status via ioctl CDROM_DRIVE_STATUS, with
no disk it gives CDS_TRAY_OPEN even if the tray is closed.

ioctl works as expected with ide-cd driver.

Gentoo bug report: http://bugs.gentoo.org/show_bug.cgi?id=196879

Cc: Maarten Bressers <mbres@gentoo.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:17 -06:00
James Bottomley 32e8ae36b8 [SCSI] libsas: don't use made up error codes
This is bad for two reasons:

     1. If they're returned to outside applications, no-one knows what
        they mean.
     2. Eventually they'll clash with the ever expanding standard error
        codes.

The problem error code in question is ETASK.  I've replaced this by
ECOMM (communications error on send) a network error code that seems to
most closely relay what ETASK meant.

Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:15 -06:00
James Bottomley 2d507a01da [SCSI] libsas, bsg: pass errors through correctly
Currently in BSG, errors returned in req->errors aren't passed back to
the calling programme (either via SG_IO or via read/write).  Fix this,
while preserving the SCSI convention of returning status in
req->errors.

Now update libsas to return errors correctly instead of to ignore
them.

Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:13 -06:00
James Bottomley 2d4b63e150 [SCSI] libsas: don't treat underrun as an error on SMP tasks
All SMP tasks sent through bsg generate messages like:

sas: smp_execute_task: task to dev 500605b000001450 response: 0x0 status 0x81

Three times (because the task gets retried).  Firstly, don't retry
either overrun or underrun (the data buffer isn't going to change size)
and secondly, just report the underrun but don't set an error for it.
This is necessary so bsg can report back the residual.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:12 -06:00
James Bottomley b98e66fa0b [SCSI] libsas: add host SMP processing
This adds support for host side SMP processing, via a separate
SMP interpreter file.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:11 -06:00
FUJITA Tomonori 38b3167f75 [SCSI] mpt fusion: make mptsas_smp_handler update resid
This patch fixes mptsas_smp_handler to update both din_resid or
dout_resid on success. bsg can report back the residual.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11 18:29:09 -06:00