27 Jul, 2008

40 commits

  • The last_sector_bug flag was added to work around a bug in certain usb
    cardreaders, where they would crash if a multiple sector read included the
    last sector. The original implementation avoids this by e.g. splitting an 8
    sector read which includes the last sector into a 7 sector read, and a single
    sector read for the last sector. The flag is enabled for all USB devices.

    This revealed a second bug in other usb cardreaders, which crash when they
    get a multiple sector read which stops 1 sector short of the last sector.
    Affected hardware includes the Kingston "MobileLite" external USB cardreader
    and the internal USB cardreader on the Asus EeePC.

    Extend the last_sector_bug workaround to ensure that any access which touches
    the last 8 hardware sectors of the device is a single sector long. Requests
    are shrunk as necessary to meet this constraint.

    This gives us a safety margin against potential unknown or future bugs
    affecting multi-sector access to the end of the device. The two known bugs
    only affect the last 2 sectors. However, they suggest that these devices
    are prone to fencepost errors and that multi-sector access to the end of the
    device is not well tested. Popular OS's use multi-sector accesses, but they
    rarely read the last few sectors. Linux (with udev & vol_id) automatically
    reads sectors from the end of the device on insertion. It is assumed that
    single sector accesses are more thoroughly tested during development.

    Signed-off-by: Alan Jenkins
    Tested-by: Alan Jenkins
    Signed-off-by: James Bottomley

    Alan Jenkins
     
  • Signed-off-by: Andrew Vasquez
    Signed-off-by: James Bottomley

    Andrew Vasquez
     
  • Minor fixes addressing:
    - rport managements during vport deletion.
    - acquire proper physical-ha during qla24xx_abort_command() and
    qla24xx_queuecommand()
    - do not needlessly acquire the pha for non-NPIV capable ISPs.

    Signed-off-by: Andrew Vasquez
    Signed-off-by: James Bottomley

    Andrew Vasquez
     
  • drivers/scsi/qla2xxx/qla_os.c: In function 'qla2x00_post_work':
    drivers/scsi/qla2xxx/qla_os.c:2158: warning: 'flags' may be used uninitialized in this function

    Signed-off-by: Andrew Morton
    Signed-off-by: Andrew Vasquez
    Signed-off-by: James Bottomley

    Andrew Morton
     
  • Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Andrew Vasquez
    Signed-off-by: James Bottomley

    Akinobu Mita
     
  • As the original code would incorrectly call the non-ISP24xx/25xx
    callbacks during recovery, a stop-firmware failure could result
    in improper bit-banging of the RISC and in some cases manifest in
    a NMI-watchdog trigger due to the RISC not coming out of its
    reset state.

    Signed-off-by: Andrew Vasquez
    Signed-off-by: James Bottomley

    Andrew Vasquez
     
  • The following commit causes ch_remove oops:

    commit 24b42566c3fcbb5a9011d1446783d0f5844ccd45
    Author: Greg Kroah-Hartman
    Date: Fri May 16 17:55:12 2008 -0700

    SCSI: fix race in device_create

    There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata(). It fixes the problem in all of the scsi
    drivers that need it.

    Cc: Kay Sievers
    Cc: Doug Gilbert
    Cc: James E.J. Bottomley
    Signed-off-by: Greg Kroah-Hartman

    The problem is ch_probe stores ch's private data at a wrong place.

    We need to store it at scsi_device->sdev_gendev but the above patch
    stores it at device struct that device_create_drvdata returns. So we
    hit an oops when ch_remove accesses
    scsi_device->sdev_gendev->driver_data, which is NULL.

    Actually, there wasn't a race because ch doesn't create sysfs files
    with device struct that device_create returns. This patch puts back
    dev_set_drvdata() to set ch's private data properly.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • This patch for the 3w-9xxx scsi driver applies on top of the
    BKL-pushdown changes in -git9.

    This patch does the following:

    - Increase max AENs drained to 256.
    - Add MSI support and "use_msi" module parameter.
    - Fix bug in twa_get_param() on 4GB+.
    - Use pci_resource_len() for ioremap().

    Signed-off-by: James Bottomley

    adam radford
     
  • I goofed and did not see the macro for checking if a request is tagged.
    This patch has us use blk_rq_tagged instead of digging into the req->tag.

    Patch was made over scsi-misc.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • Update driver version to 1.0.1.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • Add an ADISC to the target discovery job in order to sanity check whether or
    not we need to re-login to the target.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • Properly setup the size of the async event queue. This fixes a bug where async events
    were not getting processed by the driver.

    Setup target_id field in the driver's target struct so that target sysfs attributes
    work for multiple targets.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • If certain ELS events are received during module removal, after the kthread
    is stopped, the rmmod can hang. This fixes the ibmvfc driver so that ELS
    events during rmmod are ignored by stopping all device activity prior to
    killing the kthread and also changes reinitialization to not attempt a reinit
    if the adapter has been taken offline.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • Fix up some refcounting on the ibmvfc drivers internal target struct
    when accessed through some sysfs attributes.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • Reduces some unnecessary log noise by removing a printk during
    host port state query and increasing the log level required to
    log received async events.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • This patch frees the luntbl dma area in sym_hcb_free if allocated.
    Since the luntbl is part of a larger dma coherent area not freeing the
    luntbl kept a 64k dma coherent area previous allocated through
    dma_alloc_coherent allocated. This prevented a DLPAR remove IO
    operation from completing successfully.

    Signed-off-by: Mike Anderson
    Cc: Matthew Wilcox
    Signed-off-by: James Bottomley

    Mike Anderson
     
  • The mutex is released on a successful return, so it would seem that it
    should be released on an error return as well.

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

    //
    @@
    expression l;
    @@

    mutex_lock(l);
    ... when != mutex_unlock(l)
    when any
    when strict
    (
    if (...) { ... when != mutex_unlock(l)
    + mutex_unlock(l);
    return ...;
    }
    |
    mutex_unlock(l);
    )
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: James Bottomley

    Julia Lawall
     
  • This patch (as1116) fixes a bug in scsi_eh_prep_cmnd() and
    scsi_eh_restore_cmnd(). These routines are supposed to save any
    values they change and restore them later, but someone forgot to
    save & restore scmd->underflow.

    This fixes part of the problem reported in Bugzilla #9638.

    [jejb: fix up rejections around DIF/DIX]
    Signed-off-by: Alan Stern
    Signed-off-by: James Bottomley

    Alan Stern
     
  • Support for controllers and disks that implement DIF protection
    information:

    - During command preparation the RDPROTECT/WRPROTECT must be set
    correctly if the target has DIF enabled.

    - READ(6) and WRITE(6) are not supported when DIF is on.

    - The controller must be told how to handle the I/O via the
    protection operation field in scsi_cmnd.

    - Refactor the I/O completion code that extracts failed LBA from the
    returned sense data and handle DIF failures correctly.

    - sd_dif.c implements the functions required to prepare and complete
    requests with protection information attached.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • If a disk is formatted with protection information (Inquiry bit
    PROTECT=1) it is required to support Read Capacity(16). Force use of
    the 16-bit command in this case and extract the P_TYPE field which
    indicates whether the disk is formatted using DIF Type 1, 2 or 3.

    The ATO (App Tag Own) bit in the Control Mode Page indicates whether
    the storage device or the initiator own the contents of the
    DIF application tag.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • If initiator or target reject the I/O due to DIF errors there is no
    point in retrying.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • Implement support for DMA of protection information for devices that
    are data integrity capable.

    - Add support for mapping an extra scatter-gather list containing
    the protection information.

    - Allocate protection scsi_data_buffer if host is DIX (integrity DMA)
    capable.

    - Accessor function for checking whether a device has protection
    enabled.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • Controllers that support DMA of protection information must be told
    explicitly how to handle the I/O. The controller has no knowledge of
    the protection capabilities of the target device so this information
    must be passed in the scsi_cmnd.

    - The protection operation tells the HBA whether to generate, strip or
    verify protection information.

    - The protection type tells the HBA which layout the target is
    formatted with. This is necessary because the controller must be
    able to correctly interpret the included protection information in
    order to verify it.

    - When a scsi_cmnd is reused for error handling the protection
    operation must be cleared and saved while error handling is in
    progress.

    - prot_op and prot_type are placed in an existing hole in scsi_cmnd
    and don't cause the structure to grow.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • Controllers that support protection information must indicate this to
    the SCSI midlayer so that the ULD can prepare scsi_cmnds accordingly.

    This patch implements a host mask and various types of protection:

    - DIF Type 1-3 (between HBA and disk)
    - DIX Type 0-3 (between OS and HBA)

    The patch also allows the HBA to set the guard type to something
    different than the T10-mandated CRC.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • Create a cache of devices that are seen in a system. This will avoid
    the unnecessary traversal of the device list in the scsi_dh when there
    are multiple luns of a same type.

    Signed-off-by: Chandra Seetharaman
    Signed-off-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • multipath keeps a separate device table which may be
    more current than the built-in one.
    So we should make sure to always call ->attach whenever
    a multipath map with hardware handler is instantiated.
    And we should call ->detach on removal, too.

    [sekharan: update as per comments from agk]
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • This patch updates the RDAC device handler to
    refuse to attach to devices not supporting the
    RDAC vpd pages.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • This patch updates the hp_sw device handler to properly
    check the return codes etc.
    And adds the 'correct' machine definitions.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • This patch converts the EMC device handler to use a proper
    state machine. We now also parse the extended INQUIRY
    information to determine if long trespass commands are
    supported. And we're now using the long trespass command
    correctly. And finally there's now an check at init time
    to refuse to attach to devices not supporting EMC-specific
    VPD pages.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • Implement a 'dh_state' sdev attribute for dynamic device handler
    manipulation. A read on the attribute will return the name of
    the currently attached device handler or 'detached' if no handler
    is attached.
    The attribute allows the following strings to be written:
    - The name of the device handler to be attached if the state is
    'detached'.
    - 'activate' to trigger path activation if a device handler
    is attached.
    - 'detach' to detach the currently attached device handler.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • Instead of having each and every driver implement its own
    device table scanning code we should rather implement a common
    routine and scan the device tables there.
    This allows us also to implement a general notifier chain
    callback for all device handler instead for one per handler.

    [sekharan: Fix rejections caused by conflicting bug fix]
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • Daniel Debonzi reports that he has managed to wrap host_no. Increasing
    the number of host numbers available to 32-bit from 16-bit allows the
    problem to be evaded for another hundred years.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    Matthew Wilcox
     
  • Update index allocation as follows.

    * sd_index_idr is used only for ID allocation and mapping
    functionality is not used. Use more memory efficient ida instead.

    * idr and ida have their own locks inside them and don't need them for
    operation. Drop it.

    * index wasn't freed if probing failed after index allocation. fix
    it.

    * ida allocation should be repeated if it fails with -EAGAIN.

    Signed-off-by: Tejun Heo
    Signed-off-by: James Bottomley

    Tejun Heo
     
  • When drivers use a shared tag map we can end up with more requests
    than tags, because the tag map is shost->can_queue tags and there
    can be sdevs * sdev->queue_depth requests. In scsi_request_fn
    if tag allocation fails we just drop down to just dequeueing the
    tag without a tag. The problem is that drivers using the shared tag
    map rely on a valid tag always being set, because it will use the
    tag number to lookup commands later.

    This patch has us check if we got a valid tag when the host lock
    is held right before we check if the host queue is ready. We do the
    check here because to allocate the tag we need the q lock, but
    if the tag is bad we want to add the device/q onto the starved list
    which requires the host lock.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • We want to set the queue depth to something reasonable - not
    the can_queue.

    Signed-off-by: Mike Christie
    Cc: Ed Lin
    Signed-off-by: James Bottomley

    Mike Christie
     
  • We want to set the queue depth to something reasonable - not
    the can_queue.

    Signed-off-by: Mike Christie
    Cc: David Somayajulu
    Signed-off-by: James Bottomley

    Mike Christie
     
  • Currently qla4xxx and stex pass in their can_queue values into
    scsi_activate_tcq because they wanted the tag map that large.
    The problem with this is that it ends up also setting the queue
    depth to that large value. All we want to do this in this case
    is set the device queue depth and the other device settings.
    We do not need to touch the tag map sizing because the drivers
    had setup that map according to their can_queue limits when the
    shared map was created.

    The scsi mid layer in request_fn will then handle the case where we
    have more requests than available tags when it checks the host
    queue ready function.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • Mike Christie noticed a bogus memset. It can be removed as dead code
    since the number of bytes in the driver buffer in fixed block mode is
    always a multiple of the tape block size.

    Signed-off-by: Kai Mäkisara
    Signed-off-by: James Bottomley

    Kai Makisara
     
  • Move buffer pointer back when data could not be written. Bug found by
    Mike Christie.

    Signed-off-by: Kai Mäkisara
    Signed-off-by: James Bottomley

    Kai Makisara