24 Mar, 2012

1 commit

  • This addresses some header check warnings. DRM headers which include
    "drm.h" have been excluded, as they indirectly include types.h.

    Signed-off-by: Bobby Powers
    Cc: Chris Ball
    Cc: Dave Airlie
    Cc: James Bottomley
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bobby Powers
     

23 Mar, 2012

2 commits

  • SCSI updates from James Bottomley:
    "The update includes the usual assortment of driver updates (lpfc,
    qla2xxx, qla4xxx, bfa, bnx2fc, bnx2i, isci, fcoe, hpsa) plus a huge
    amount of infrastructure work in the SAS library and transport class
    as well as an iSCSI update. There's also a new SCSI based virtio
    driver."

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (177 commits)
    [SCSI] qla4xxx: Update driver version to 5.02.00-k15
    [SCSI] qla4xxx: trivial cleanup
    [SCSI] qla4xxx: Fix sparse warning
    [SCSI] qla4xxx: Add support for multiple session per host.
    [SCSI] qla4xxx: Export CHAP index as sysfs attribute
    [SCSI] scsi_transport: Export CHAP index as sysfs attribute
    [SCSI] qla4xxx: Add support to display CHAP list and delete CHAP entry
    [SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry
    [SCSI] pm8001: fix endian issue with code optimization.
    [SCSI] pm8001: Fix possible racing condition.
    [SCSI] pm8001: Fix bogus interrupt state flag issue.
    [SCSI] ipr: update PCI ID definitions for new adapters
    [SCSI] qla2xxx: handle default case in qla2x00_request_firmware()
    [SCSI] isci: improvements in driver unloading routine
    [SCSI] isci: improve phy event warnings
    [SCSI] isci: debug, provide state-enum-to-string conversions
    [SCSI] scsi_transport_sas: 'enable' phys on reset
    [SCSI] libsas: don't recover end devices attached to disabled phys
    [SCSI] libsas: fixup target_port_protocols for expanders that don't report sata
    [SCSI] libsas: set attached device type and target protocols for local phys
    ...

    Linus Torvalds
     
  • Pull SCSI target updates from Nicholas Bellinger:
    "This contains the usual set of updates and bugfixes to target-core +
    existing fabric module code, along with a handful of the patches
    destined for v3.3 stable.

    It also contains the necessary target-core infrastructure pieces
    required to run using tcm_qla2xxx.ko WWPNs with the new Qlogic Fibre
    Channel fabric module currently queued in target-pending/for-next-merge,
    and coming for round 2.

    The highlights for this series include:

    - Add target_submit_tmr() helper function for fabric task management
    (andy)
    - Convert tcm_fc to use target_submit_tmr() (andy)
    - Replace target core various cmd flags with a transport state (hch)
    - Convert loopback to use workqueue submission (hch)
    - Convert target core to use array_zalloc for tpg_lun_list (joern)
    - Convert target core to use array_zalloc for device_list (joern)
    - Add target core support for TMR_ABORT_TASK (nab)
    - Add target core se_sess->sess_kref + get/put helpers (nab)
    - Add target core se_node_acl->acl_kref for ->acl_free_comp usage
    (nab)
    - Convert iscsi-target to use target_put_session + sess_kref (nab)
    - Fix tcm_fc fc_exch memory leak in ft_send_resp_status (nab)
    - Fix ib_srpt srpt_handle_cmd send_ioctx->ioctx_kref leak on
    exception (nab)
    - Fix target core up handling of short INQUIRY buffers (roland)
    - Untangle target-core front-end and back-end meanings of max_sectors
    attribute (roland)
    - Set loopback residual field for SCSI commands (roland)
    - Fix target-core 16-bit target ports for SET TARGET PORT GROUPS
    emulation (roland)

    Thanks again to Andy, Christoph, Joern, Roland, and everyone who has
    contributed this round!"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (64 commits)
    ib_srpt: Fix srpt_handle_cmd send_ioctx->ioctx_kref leak on exception
    loopback: Fix transport_generic_allocate_tasks error handling
    iscsi-target: remove improper externs
    iscsi-target: Remove unused variables in iscsi_target_parameters.c
    target: remove obvious warnings
    target: Use array_zalloc for device_list
    target: Use array_zalloc for tpg_lun_list
    target: Fix sense code for unsupported SERVICE ACTION IN
    target: Remove hack to make READ CAPACITY(10) lie if thin provisioning is enabled
    target: Bump core version to v4.1.0-rc2-ml + fabric versions
    tcm_fc: Fix fc_exch memory leak in ft_send_resp_status
    target: Drop unused legacy target_core_fabric_ops API callers
    iscsi-target: Convert to use target_put_session + sess_kref
    target: Convert se_node_acl->acl_group removal to use ->acl_kref
    target: Add se_node_acl->acl_kref for ->acl_free_comp usage
    target: Add se_node_acl->acl_free_comp for NodeACL release path
    target: Add se_sess->sess_kref + get/put helpers
    target: Convert session_lock to irqsave
    target: Fix typo in drivers/target
    iscsi-target: Fix dynamic -> explict NodeACL pointer reference
    ...

    Linus Torvalds
     

01 Mar, 2012

10 commits

  • Signed-off-by: Mike Christie
    Signed-off-by: Vikas Chaudhary
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • For offload iSCSI like qla4xxx CHAP entries are stored in FLASH.
    This patch adds support to list CHAP entries stored in FLASH and
    delete specified CHAP entry from FLASH using iscsi tools.

    Signed-off-by: Nilesh Javali
    Signed-off-by: Vikas Chaudhary
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Nilesh Javali
     
  • libata issues follow up srsts when the controller has a hard time
    recording the signature-fis after a reset, or if the link supports port
    multipliers. libsas does not support port multipliers and no current
    libsas lldds appear to need help retrieving the signature fis. Revert
    it for now to remove confusion.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libsas ata error handling is already async but this does not help the
    scan case. Move initial link recovery out from under host->scan_mutex,
    and delay synchronization with eh until after all port probe/recovery
    work has been queued.

    Device ordering is maintained with scan order by still calling
    sas_rphy_add() in order of domain discovery.

    Since we now scan the domain list when invoking libata-eh we need to be
    careful to check for fully initialized ata ports.

    Acked-by: Jack Wang
    Acked-by: Jeff Garzik
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • ata devices are always scanned after ssp. Prior to the ata error
    handling reworks libsas would tend to scan devices in ascending expander
    phy order. Restore this ordering by deferring ssp discovery to a
    DISCE_PROBE event, and keep the probe order consistent with the
    discovery order, not the placement of sata devices.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libsas fails to discover all sata devices in the domain. If a device fails
    negotiation and does not transmit a signature fis the link needs recovery.
    libata already understands how to manage slow to come up links, so treat these
    conditions as ata device attach events for the purposes of creating an
    ata_port. This allows libata to manage retrying link bring up.

    Rediscovery is modified to be careful about checking changes in dev_type. It
    looks like libsas leaks old devices if the sas address changes, but that's a
    fix for another patch.

    Acked-by: Jack Wang
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • If we have a domain with sas and sata devices there may still be sas
    recovery actions to take after peeling off the commands to send to
    libata.

    Reported-by: Andrzej Jakowski
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • If the top level expander is hot removed, mark all child devices as gone
    before unregistration to short circuit futile recovery.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • In the direct-attached case this routine returns the phy on which this
    device was first discovered. Which is broken if we want to support
    wide-targets, as this phy reference can become stale even though the
    port is still active.

    In the expander-attached case this routine tries to lookup the phy by
    scanning the attached sas addresses of the parent expander, and BUG_ONs
    if it can't find it. However since eh and the libsas workqueue run
    independently we can still be attempting device recovery via eh after
    libsas has recorded the device as detached. This is even easier to hit
    now that eh is blocked while device domain rediscovery takes place, and
    that libata is fed more timed out commands increasing the chances that
    it will try to recover the ata device.

    Arrange for dev->phy to always point to a last known good phy, it may be
    stale after the port is torn down, but it will catch up for wide port
    reconfigurations, and never be NULL.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Use ata_wait_after_reset() to poll for link recovery after a reset.
    This combined with sas_ha->eh_mutex prevents expander rediscovery from
    probing phys in an intermediate state. Local discovery does not have a
    mechanism to filter link status changes during this timeout, so it
    remains the responsibility of lldds to prevent premature port teardown.
    Although once all lldd's support ->lldd_ata_check_ready() that could be
    used as a gate to local port teardown.

    The signature fis is re-transmitted when the link comes back so we
    should be revalidating the ata device class, but that is left to a future
    patch.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

26 Feb, 2012

2 commits


20 Feb, 2012

20 commits

  • SAS does not tag SMP requests, and at least one lldd (isci) does not permit
    more than one in-flight request at a time.

    [jejb: fix sas_init_dev tab issues while we're at it]
    Signed-off-by: Jeff Skirvin
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Jeff Skirvin
     
  • Execute the link-reset triggered by sas_phy_enable via
    transport_sas_phy_reset so that it can be managed by libata.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Link resets leave ata affiliations intact, so arrange for libsas to make
    an effort to avoid dropping the device due to a slow-to-recover link.
    Towards this end carry out reset in the host workqueue so that it can
    check for ata devices and kick the reset request to libata. Hard
    resets, in contrast, bypass libata since they are meant for associating
    an ata device with another initiator in the domain (tears down
    affiliations).

    Need to add a new transport_sas_phy_reset() since the current
    sas_phy_reset() is a utility function to libsas lldds. They are not
    prepared for it to loop back into eh.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Extend the sas transport class to allow transport users to attach extra
    data to a sas_phy (->hostdata). Use this area in libsas to move resets
    to workq context in preparation for scheduling ata device resets through
    libata-eh.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Since sata devices can take several seconds to recover the link on reset
    the 0.5 seconds that libsas currently waits may not be enough. Instead
    if we are rediscovering a phy that was previously attached to a sata
    device let libata handle any resets to encourage the device to transmit
    the initial fis.

    Once sas_ata_hard_reset() and lldds learn how to honor 'deadline' libsas
    should stop encountering phys in an intermediate state, until then this
    will loop until the fis is transmitted or ->attached_sas_addr gets
    cleared, but in the more likely initial discovery case we keep existing
    behavior.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libsas-eh if it successfully aborts an ata command will hide the timeout
    condition (AC_ERR_TIMEOUT) from libata. The command likely completes
    with the all-zero task->task_status it started with. Instead, interpret
    a TMF_RESP_FUNC_COMPLETE as the end of the sas_task but keep the scmd
    around for libata-eh to handle.

    Tested-by: Andrzej Jakowski
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Until we have told the lldd to forget a task a timed out operation can
    return from the hardware at any time. Since completion frees the task
    we need to make sure that no tasks run their normal completion handler
    once eh has decided to manage the task. Similar to
    ata_scsi_cmd_error_handler() freeze completions to let eh judge the
    outcome of the race.

    Task collector mode is problematic because it presents a situation where
    a task can be timed out and aborted before the lldd has even seen it.
    For this case we need to guarantee that a task that an lldd has been
    told to forget does not get queued after the lldd says "never seen it".
    With sas_scsi_timed_out we achieve this with the ->task_queue_flush
    mutex, rather than adding more time.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • We invoke task->task_done() to free the task in the eh case, but at this
    point we are prepared for scsi_eh_flush_done_q() to finish off the scmd.

    Introduce sas_end_task() to capture the final response status from the
    lldd and free the task.

    Also take the opportunity to kill this warning.
    drivers/scsi/libsas/sas_scsi_host.c: In function ‘sas_end_task’:
    drivers/scsi/libsas/sas_scsi_host.c:102:3: warning: case value ‘2’ not in enumerated type ‘enum exec_status’ [-Wswitch]

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Since sas_ata does not implement ->freeze(), completions for scmds and
    internal commands can still arrive concurrent with
    ata_scsi_cmd_error_handler() and sas_ata_post_internal() respectively.
    By the time either of those is called libata has committed to completing
    the qc, and the ATA_PFLAG_FROZEN flag tells sas_ata_task_done() it has
    lost the race.

    In the sas_ata_post_internal() case we take on the additional
    responsibility of freeing the sas_task to close the race with
    sas_ata_task_done() freeing the the task while sas_ata_post_internal()
    is in the process of invoking ->lldd_abort_task().

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • sas_discover_sata() notifies lldds of sata devices twice. Once to allow
    the 'identify' to be sent, and a second time to allow aic94xx (the only
    libsas driver that cares about sata_dev.identify) to setup NCQ
    parameters before the device becomes known to the midlayer. Replace
    this double notification and intervening 'identify' with an explicit
    ->lldd_ata_set_dmamode notification. With this change all ata internal
    commands are issued by libata, so we no longer need sas_issue_ata_cmd().

    The data from the identify command only needs to be cached in one
    location so ata_device.id replaces domain_device.sata_dev.identify.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libata error handling provides for a timeout for link recovery. libsas
    must not rescan for previously known devices in this interval otherwise
    it may remove a device that is simply waiting for its link to recover.
    Let libata-eh make the determination of when the link is stable and
    prevent libsas (host workqueue) from taking action while this
    determination is pending.

    Using a mutex (ha->disco_mutex) to flush and disable revalidation while
    eh is running requires any discovery action that may block on eh be
    moved to its own context outside the lock. Probing ATA devices
    explicitly waits on ata-eh and the cache-flush-io issued during device
    removal may also pend awaiting eh completion. Essentially any rphy
    add/remove activity needs to run outside the lock.

    This adds two new cleanup states for sas_unregister_domain_devices()
    'allocated-but-not-probed', and 'flagged-for-destruction'. In the
    'allocated-but-not-probed' state dev->rphy points to a rphy that is
    known to have not been through a sas_rphy_add() event. At domain
    teardown check if this device is still pending probe and cleanup
    accordingly. Similarly if a device has already been queued for removal
    then sas_unregister_domain_devices has nothing to do.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • In preparation for adding tracking of another device state "destroy".

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • When an lldd invokes ->notify_port_event() it can trigger a chain of libsas
    events to:

    1/ form the port and find the direct attached device

    2/ if the attached device is an expander perform domain discovery

    A call to flush_workqueue() will only flush the initial port formation work.
    Currently libsas users need to call scsi_flush_work() up to the max depth of
    chain (which will grow from 2 to 3 when ata discovery is moved to its own
    discovery event). Instead of open coding multiple calls switch to use
    drain_workqueue() to flush sas work.

    drain_workqueue() does not handle new work submitted during the drain so
    libsas needs a bit of infrastructure to hold off unchained work submissions
    while a drain is in flight. A lldd ->notify() event is considered 'unchained'
    while a sas_discover_event() is 'chained'. As Tejun notes:

    "For now, I think it would be best to add private wrapper in libsas to
    support deferring unchained work items while draining."

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • In preparation for adding new states (SAS_HA_DRAINING, SAS_HA_FROZEN),
    convert ha->state into a set of flags.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • The locks only served to make sure the pending event bitmask was updated
    consistently.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • These are never freed in the nominal path. A domain_device has a
    different lifetime than a sas_rphy we need a dev->rphy independent way
    of identifying sata devices.

    Reviewed-by: Jack Wang
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Arrange for the deallocation of a struct domain_device object when it no
    longer has:
    1/ any children
    2/ references by any scsi_targets
    3/ references by a lldd

    The comment about domain_device lifetime in
    Documentation/scsi/libsas.txt is stale as it appears mainline never had
    a version of a struct domain_device that was registered as a kobject.
    We now manage domain_device reference counts on behalf of external
    agents.

    Reviewed-by: Jack Wang
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Per commit 3e4ec344 "libata: kill ATA_FLAG_DISABLED" needing to set
    ATA_DEV_NONE is a holdover from before libsas converted to the
    "new-style" ata-eh.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Commit 1e34c838 "[SCSI] libsas: remove spurious sata control register
    read/write" removed the routines to fake the presence of the sata
    control registers, now remove the unused data structure fields to kill
    any remaining confusion.

    Acked-by: Jack Wang
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • We have experienced several devices which fail in a fashion we do not
    currently handle gracefully in SCSI. After a failure these devices will
    respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
    but any command accessing the storage medium will time out.

    The following patch adds an callback that can be used by upper level
    drivers to inspect the results of an error handling command. This in
    turn has been used to implement additional checking in the SCSI disk
    driver.

    If a medium access command fails twice but TEST UNIT READY succeeds both
    times in the subsequent error handling we will offline the device. The
    maximum number of failed commands required to take a device offline can
    be tweaked in sysfs.

    Also add a new error flag to scsi_debug which allows this scenario to be
    easily reproduced.

    [jejb: fix up integer parsing to use kstrtouint]
    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

19 Feb, 2012

5 commits

  • Added ping support for iscsi adapter, application can use this
    interface for diagnostic network connection.

    Signed-off-by: Vikas Chaudhary
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Vikas Chaudhary
     
  • Added support to post kernel host event to application using
    netlink interface.

    Signed-off-by: Vikas Chaudhary
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Vikas Chaudhary
     
  • Problem description from Xi Wang:
    A large max_r2t could lead to integer overflow in subsequent call to
    iscsi_tcp_r2tpool_alloc(), allocating a smaller buffer than expected
    and leading to out-of-bounds write.

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

    Mike Christie
     
  • Resubmitting as my previous post had format issues and did not go llinux-scsi.
    This patch changes the function to set_msg_byte, set_host_byte and
    set_driver_byte to correctly set the corresponding bytes appropriately.

    It will reset the original setting and correctly set it to the new value. The
    previous OR operation does not always set it back to new value. Look at patch
    2/2 for an example.

    Signed-off-by: Babu Moger
    Signed-off-by: James Bottomley

    Moger, Babu
     
  • This patch adds support for Fabric Device Management
    Interface as per FC-GS-4 spec. in libfc. Any driver
    making use of libfc can enable fdmi state machine
    for a given lport.

    If lport has enabled FDMI support the lport state
    machine will transition into FDMI after completing
    the DNS states and before entering the SCR state.
    The FDMI state transition is such that if there is an
    error, it won't stop the lport state machine from
    transitioning and the it will behave as if there was
    no FDMI support.

    The FDMI HBA attributes are registed with the Management
    server via Register HBA (RHBA) command and the port
    attributes are reigstered using the Register Port(RPA)
    command.

    Signed-off-by: Neerav Parikh
    Tested-by: Ross Brattain
    Acked-by: Robert Love
    Signed-off-by: James Bottomley

    Neerav Parikh