05 Jun, 2013

1 commit

  • Remove the arbitrary expectation in libsas that all SCSI commands are 16 bytes
    or less. Instead do all copies via cmd->cmd_len (and use a pointer to this in
    the libsas task instead of a copy). Note that this still doesn't enable > 16
    byte CDB support in the underlying drivers because their internal format has
    to be fixed and the wire format of > 16 byte CDBs according to the SAS spec is
    different. the libsas drivers (isci, aic94xx, mvsas and pm8xxx are all
    updated for this change.

    Cc: Lukasz Dorau
    Cc: Maciej Patelczyk
    Cc: Dave Jiang
    Cc: Jack Wang
    Cc: Lindar Liu
    Cc: Xiangliang Yu
    Signed-off-by: James Bottomley

    James Bottomley
     

10 May, 2013

2 commits

  • Signed-off-by: James Bottomley

    James Bottomley
     
  • These enums have been separate since the dawn of SAS, mainly because the
    latter is a procotol only enum and the former includes additional state
    for libsas. The dichotomy causes endless confusion about which one you
    should use where and leads to pointless warnings like this:

    drivers/scsi/mvsas/mv_sas.c: In function 'mvs_update_phyinfo':
    drivers/scsi/mvsas/mv_sas.c:1162:34: warning: comparison between 'enum sas_device_type' and 'enum sas_dev_type' [-Wenum-compare]

    Fix by eliminating one of them. The one kept is effectively the sas.h
    one, but call it sas_device_type and make sure the enums are all
    properly namespaced with the SAS_ prefix.

    Signed-off-by: James Bottomley

    James Bottomley
     

09 May, 2013

1 commit

  • Pull block core updates from Jens Axboe:

    - Major bit is Kents prep work for immutable bio vecs.

    - Stable candidate fix for a scheduling-while-atomic in the queue
    bypass operation.

    - Fix for the hang on exceeded rq->datalen 32-bit unsigned when merging
    discard bios.

    - Tejuns changes to convert the writeback thread pool to the generic
    workqueue mechanism.

    - Runtime PM framework, SCSI patches exists on top of these in James'
    tree.

    - A few random fixes.

    * 'for-3.10/core' of git://git.kernel.dk/linux-block: (40 commits)
    relay: move remove_buf_file inside relay_close_buf
    partitions/efi.c: replace useless kzalloc's by kmalloc's
    fs/block_dev.c: fix iov_shorten() criteria in blkdev_aio_read()
    block: fix max discard sectors limit
    blkcg: fix "scheduling while atomic" in blk_queue_bypass_start
    Documentation: cfq-iosched: update documentation help for cfq tunables
    writeback: expose the bdi_wq workqueue
    writeback: replace custom worker pool implementation with unbound workqueue
    writeback: remove unused bdi_pending_list
    aoe: Fix unitialized var usage
    bio-integrity: Add explicit field for owner of bip_buf
    block: Add an explicit bio flag for bios that own their bvec
    block: Add bio_alloc_pages()
    block: Convert some code to bio_for_each_segment_all()
    block: Add bio_for_each_segment_all()
    bounce: Refactor __blk_queue_bounce to not use bi_io_vec
    raid1: use bio_copy_data()
    pktcdvd: Use bio_reset() in disabled code to kill bi_idx usage
    pktcdvd: use bio_copy_data()
    block: Add bio_copy_data()
    ...

    Linus Torvalds
     

06 Apr, 2013

2 commits

  • If a result of the SMP discover function is PHY VACANT,
    the content of discover response structure (dr) is not valid.
    It sometimes happens that dr->attached_sas_addr can contain
    even SAS address of other phy. In such case an invalid phy
    is created, what causes NULL pointer dereference during
    destruction of expander's phys.

    So if a result of SMP function is PHY VACANT, the content of discover
    response structure (dr) must not be copied to phy structure.

    This patch fixes the following bug:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
    IP: [] sysfs_find_dirent+0x12/0x90
    Call Trace:
    [] sysfs_get_dirent+0x35/0x80
    [] sysfs_unmerge_group+0x1e/0xb0
    [] dpm_sysfs_remove+0x24/0x90
    [] device_del+0x44/0x1d0
    [] sas_rphy_delete+0x9/0x20 [scsi_transport_sas]
    [] sas_destruct_devices+0xe6/0x110 [libsas]
    [] process_one_work+0x16c/0x350
    [] worker_thread+0x17a/0x410
    [] kthread+0x96/0xa0
    [] kernel_thread_helper+0x4/0x10

    Signed-off-by: Lukasz Dorau
    Signed-off-by: Pawel Baldysiak
    Reviewed-by: Maciej Patelczyk
    Cc:
    Signed-off-by: James Bottomley

    Lukasz Dorau
     
  • In fact the disc_resp buffer will be overwrite by smp response, so we never
    found this typo, correct it by using the right one.

    Signed-off-by: John Gong
    Signed-off-by: Jack Wang
    Signed-off-by: James Bottomley

    John Gong
     

24 Mar, 2013

1 commit

  • More prep work for immutable bvecs/effecient bio splitting - usage of
    bi_vcnt has to be auditing, so getting rid of all the unnecessary usage
    makes that easier.

    Plus, bio_segments() is really what this code wanted, as it respects the
    current value of bi_idx.

    Signed-off-by: Kent Overstreet
    CC: Jens Axboe
    CC: Eric Moore
    CC: "James E.J. Bottomley"
    CC: linux-scsi@vger.kernel.org

    Kent Overstreet
     

19 Nov, 2012

1 commit


24 Aug, 2012

2 commits

  • libsas and ipr pass flags to ata_host_init that are meant for the port.

    ata_host flags:
    ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
    ATA_HOST_STARTED = (1 << 1), /* Host started */
    ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
    ATA_HOST_IGNORE_ATA = (1 << 3), /* Ignore ATA devices on this host. */

    flags passed by libsas:
    ATA_FLAG_SATA = (1 << 1),
    ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
    ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */

    The only one that aliases is ATA_HOST_STARTED which is a 'don't care' in
    the libsas and ipr cases since ata_hosts from these sources are not
    registered with libata.

    Reported-by: Hannes Reinecke
    Signed-off-by: Dan Williams
    Acked-by: Brian King
    Acked-by: Jeff Garzik
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libsas power management routines to suspend and recover the sas domain
    based on a model where the lldd is allowed and expected to be
    "forgetful".

    sas_suspend_ha - disable event processing allowing the lldd to take down
    links without concern for causing hotplug events.
    Regardless of whether the lldd actually posts link down
    messages libsas notifies the lldd that all
    domain_devices are gone.

    sas_prep_resume_ha - on the way back up before the lldd starts link
    training clean out any spurious events that were
    generated on the way down, and re-enable event
    processing

    sas_resume_ha - after the lldd has started and decided that all phys
    have posted link-up events this routine is called to let
    libsas start it's own timeout of any phys that did not
    resume. After the timeout an lldd can cancel the
    phy teardown by posting a link-up event.

    Storage for ex_change_count (u16) and phy_change_count (u8) are changed
    to int so they can be set to -1 to indicate 'invalidated'.

    Signed-off-by: Dan Williams
    Reviewed-by: Jacek Danecki
    Tested-by: Maciej Patelczyk
    Acked-by: Alan Stern
    Signed-off-by: James Bottomley

    Dan Williams
     

20 Jul, 2012

11 commits

  • This is in preparation for teaching async_synchronize_full() to sync all
    pending async work, and not just on the async_running domain. This
    conversion is functionally equivalent, just embedding the existing list
    in a new async_domain type.

    The .registered attribute is used in a later patch to distinguish
    between domains that want to be flushed by async_synchronize_full()
    versus those that only expect async_synchronize_{full|cookie}_domain to
    be used for flushing.

    [jejb: add async.h to scsi_priv.h for struct async_domain]
    Signed-off-by: Dan Williams
    Acked-by: Arjan van de Ven
    Acked-by: Mark Brown
    Tested-by: Eldad Zack
    Signed-off-by: James Bottomley

    Dan Williams
     
  • The timer and the completion are only used for slow path tasks (smp, and
    lldd tmfs), yet we incur the allocation space and cpu setup time for
    every fast path task.

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

    Dan Williams
     
  • On the way to add a new sata_device field, noticed that libsas is
    carrying port multiplier infrastructure that is explicitly disabled by
    sas_discover_sata(). The aic94xx touches the unused port_no, so leave
    that field in case there was some use for it.

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

    Dan Williams
     
  • commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev()
    commit 19252de6 [SCSI] libsas: fix wide port hotplug issues

    The above commits seem to have confused the return value of
    sas_ex_discover_dev which is non-zero on failure and
    sas_ex_join_wide_port which just indicates short circuiting discovery on
    already established ports. The result is random discovery failures
    depending on configuration.

    Calls to sas_ex_join_wide_port are the source of the trouble as its
    return value is errantly assigned to 'res'. Convert it to bool and stop
    returning its result up the stack.

    Cc:
    Tested-by: Dan Melnic
    Reported-by: Dan Melnic
    Signed-off-by: Dan Williams
    Reviewed-by: Jack Wang
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Continue running revalidation until no more broadcast devices are
    discovered. Fixes cases where re-discovery completes too early in a
    domain with multiple expanders with pending re-discovery events.
    Servicing BCNs can get backed up behind error recovery.

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

    Dan Williams
     
  • The discovery function "sas_rediscover_dev" had two bugs: 1) it did
    not pay attention to the return status from the SMP task execution;
    2) the stack variable used for the returned SAS address was compared
    against 0 without being initialized.

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

    Jeff Skirvin
     
  • sas_eh_bus_reset_handler() amounts to sas_phy_reset() without
    notification of the reset to the lldd. If this is triggered from
    eh-cmnd recovery there may be sas_tasks for the lldd to terminate, so
    ->lldd_I_T_nexus_reset is warranted.

    Cc: Xiangliang Yu
    Cc: Luben Tuikov
    Cc: Jack Wang
    Reviewed-by: Jacek Danecki
    [jacek: modify pm8001_I_T_nexus_reset to return -ENODEV]
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • When recovering failed eh-cmnds let the lldd attempt an abort via
    scsi_abort_eh_cmnd before escalating.

    Reviewed-by: Jacek Danecki
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • The strategy handlers may be called in places that are problematic for
    libsas (i.e. sata resets outside of domain revalidation filtering /
    libata link recovery), or problematic for userspace (non-blocking ioctl
    to sleeping reset functions). However, these routines are also called
    for eh escalations and recovery of scsi_eh_prep_cmnd(), so permit them
    as long as we are running in the host's error handler, otherwise arrange
    for them to be triggered in eh_context.

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

    Dan Williams
     
  • eh is woken up automatically by the presence of failed commands,
    scsi_schedule_eh is reserved for cases where there are no failed
    commands. This guarantees that host_eh_sceduled is only incremented
    when an explicit eh request is made.

    Reviewed-by: Jacek Danecki
    Signed-off-by: Maciej Trela
    [fixed spurious delete of sas_ata_task_abort]
    Signed-off-by: Artur Wojcik
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Maciej Trela
     
  • When managing shost->host_eh_scheduled libata assumes that there is a
    1:1 shost-to-ata_port relationship. libsas creates a 1:N relationship
    so it needs to manage host_eh_scheduled cumulatively at the host level.
    The sched_eh and end_eh port port ops allow libsas to track when domain
    devices enter/leave the "eh-pending" state under ha->lock (previously
    named ha->state_lock, but it is no longer just a lock for ha->state
    changes).

    Since host_eh_scheduled indicates eh without backing commands pinning
    the device it can be deallocated at any time. Move the taking of the
    domain_device reference under the port_lock to guarantee that the
    ata_port stays around for the duration of eh.

    Reviewed-by: Jacek Danecki
    Acked-by: Jeff Garzik
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

08 Jul, 2012

1 commit

  • fill_result_tf() grabs the taskfile flags from the originating qc which
    sas_ata_qc_fill_rtf() promptly overwrites. The presence of an
    ata_taskfile in the sata_device makes it tempting to just copy the full
    contents in sas_ata_qc_fill_rtf(). However, libata really only wants
    the fis contents and expects the other portions of the taskfile to not
    be touched by ->qc_fill_rtf. To that end store a fis buffer in the
    sata_device and use ata_tf_from_fis() like every other ->qc_fill_rtf()
    implementation.

    Cc:
    Reported-by: Praveen Murali
    Tested-by: Praveen Murali
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

23 Apr, 2012

8 commits

  • This reverts commit a692b0eec5efae382dfa800e8b4b083f172921a7.

    Tom reports:

    [ 8.741033] ------------[ cut here ]------------
    [ 8.741038] WARNING: at fs/sysfs/dir.c:508 sysfs_add_one+0xc1/0xf0()
    [ 8.741040] Hardware name: To Be Filled By O.E.M.
    [ 8.741041] sysfs: cannot create duplicate filename

    ...and missing 2 out of 4 drives connected to mvsas. Commit a692b0ee
    made the assumption that all the phy ids an lldd registers to libsas are
    unique. However, in the "multi-chip" case mvsas does a rather annoying
    duplication of phy ids in the array passed to libsas. So, for example,
    chip0 has phy0-3 at ha phy index 0-3 and chip1 has its phy0-3 at ha phy
    index 4-7. The more natural model would be to create a scsi_host (and
    sas_ha) per chip (controller), but for now revert the naming fix which
    unfortunately means dealing with unpredictable end-device names for a
    bit longer.

    Cc: Xiangliang Yu
    Cc: Patrick Thomson
    Reported-by: Tom Rini
    Tested-by: Tom Rini
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Normalize phy->attached_sas_addr to return a zero-address in the case
    when device-type == NO_DEVICE or the linkrate is invalid to handle
    expanders that put non-zero sas addresses in the discovery response:

    sas: ex 5001b4da000f903f phy02:U:0 attached: 0100000000000000 (no device)
    sas: ex 5001b4da000f903f phy01:U:0 attached: 0100000000000000 (no device)
    sas: ex 5001b4da000f903f phy03:U:0 attached: 0100000000000000 (no device)
    sas: ex 5001b4da000f903f phy00:U:0 attached: 0100000000000000 (no device)

    Reported-by: Andrzej Jakowski
    Signed-off-by: Dan Williams
    Cc: stable@vger.kernel.org
    Signed-off-by: James Bottomley

    Dan Williams
     
  • This changes the ordering of initialization and probing events from:
    1/ allocate rphy in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN
    2/ allocate ata_port and schedule port probe in DISCE_PROBE
    ...to:
    1/ allocate ata_port in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN
    2/ allocate rphy in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN
    3/ schedule port probe in DISCE_PROBE

    This ordering prevents PHYE_SIGNAL_LOSS_EVENTS from sneaking in to
    destrory ata devices before they have been fully initialized:

    BUG: unable to handle kernel paging request at 0000000000003b10
    IP: [] sas_ata_end_eh+0x12/0x5e [libsas]
    ...
    [] sas_unregister_common_dev+0x78/0xc9 [libsas]
    [] sas_unregister_dev+0x4f/0xad [libsas]
    [] sas_unregister_domain_devices+0x7f/0xbf [libsas]
    [] sas_deform_port+0x61/0x1b8 [libsas]
    [] sas_phye_loss_of_signal+0x29/0x2b [libsas]

    ...and kills the awkward "sata domain_device briefly existing in the
    domain without an ata_port" state.

    Reported-by: Michal Kosciowski
    Signed-off-by: Dan Williams
    Acked-by: Jeff Garzik
    Signed-off-by: James Bottomley

    Dan Williams
     
  • The check_ready implementation in the expander-attached ata device case
    polls on sas_ex_phy_discover(). The effect is that the ex_phy fields
    (critically ->attached_sas_addr) can change. When ata_eh ends and
    libsas comes along to revalidate the domain
    sas_unregister_devs_sas_addr() can fail to lookup devices to remove, or
    fail to re-add an ata device that ata_eh marked as disabled. So change
    the code to skip the sas_address and change count updates when ata_eh is
    active.

    Cc: Jack Wang
    Tested-by: Maciej Patelczyk
    Tested-by: Bartek Nowakowski
    Tested-by: Jacek Danecki
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Since the domain_device can out live the scsi_target we need the rphy to
    follow suit otherwise we run into issues like:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
    IP: [] sas_ata_printk+0x43/0x6f [libsas]
    PGD 0
    Oops: 0000 [#1] SMP
    CPU 1
    Modules linked in: ses enclosure isci libsas scsi_transport_sas fuse sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf microcode pcspkr igb joydev iTCO_wdt ioatdma iTCO_vendor_support i2c_i801 i2c_core dca wmi hed ipv6 pata_acpi ata_generic [last unloaded: scsi_wait_scan]

    Pid: 129, comm: kworker/u:3 Not tainted 3.3.0-rc5-isci+ #1 Intel Corporation SandyBridge Platform/To be filled by O.E.M.
    RIP: 0010:[] [] sas_ata_printk+0x43/0x6f [libsas]
    RSP: 0018:ffff88042232dd70 EFLAGS: 00010282
    RAX: 0000000000000000 RBX: ffff8804283165b8 RCX: ffff88042232dda0
    RDX: ffff88042232dd78 RSI: ffff8804283165b8 RDI: ffffffffa01188d7
    RBP: ffff88042232ddd0 R08: ffff880388454000 R09: ffff8803edfde1f8
    R10: ffff8803edfde1f8 R11: ffff8803edfde1f8 R12: ffff880428316750
    R13: ffff880388454000 R14: ffff8803f88b31d0 R15: ffff8803f8b21d50
    FS: 0000000000000000(0000) GS:ffff88042ee20000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 0000000000000050 CR3: 0000000001a05000 CR4: 00000000000406e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process kworker/u:3 (pid: 129, threadinfo ffff88042232c000, task ffff88042230c920)
    Stack:
    0000000000000000 ffff880400000018 ffff88042232dde0 ffff88042232dda0
    ffffffffa01188c4 ffff88042ee93af0 ffff88042232ddb0 ffffffff8100e047
    ffff88042232de10 ffff880420e5a2c8 ffff8803f8b21d50 ffff8803edfde1f8
    Call Trace:
    [] ? load_TLS+0xb/0xf
    [] async_sas_ata_eh+0x66/0x95 [libsas]
    [] async_run_entry_fn+0x9e/0x131

    Reported-by: Tom Jackson
    Tested-by: Tom Jackson
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Commit 899fcf4 "[SCSI] libsas: set attached device type and target
    protocols for local phys" setup 'phy' to be dereferenced after
    list_for_each_entry(phy, &port->phy_list, port_phy_el) (i.e. phy ==
    &port->phy_list) resulting in reports like:

    BUG: unable to handle kernel NULL pointer dereference at 00000000000002b0
    IP: [] sas_discover_domain+0x29e/0x4fb [libsas]

    ...fix by deferring sas_phy_set_target() to the end of
    sas_get_port_device().

    Reported-by: Tom Jackson
    Tested-by: Tom Jackson
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • If an expander reports 'PHY VACANT' for a phy index prior to the one
    that generated a BCN libsas fails rediscovery. Since a vacant phy is
    defined as a valid phy index that will never have an attached device
    just continue the search.

    Cc:
    Signed-off-by: Thomas Jackson
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Thomas Jackson
     
  • When requeuing work to a draining workqueue the last work instance may
    not be idle, so sas_queue_work() must not touch work->entry. Introduce
    sas_work with a drain_node list_head to have a private list for
    collecting work deferred due to drain collision.

    Fixes reports like:
    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] process_one_work+0x2e/0x338

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

    Dan Williams
     

23 Mar, 2012

1 commit

  • 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
     

20 Mar, 2012

1 commit


01 Mar, 2012

8 commits

  • If userspace has decided to disable a phy the kernel should honor that
    and not inadvertantly re-enable the phy via error recovery. This is
    more straightforward in the sata case where link recovery (via
    libata-eh) is separate from sas_task cancelling in libsas-eh. Teach
    libsas to accept -ENODEV as a successful response from I_T_nexus_reset
    ('successful' in terms of not escalating further).

    This is a more comprehensive fix then "libsas: don't recover 'gone'
    devices in sas_ata_hard_reset()", as it is no longer sata-specific.

    aic94xx does check the return value from sas_phy_reset() so if the phy
    is disabled we proceed with clearing the I_T_nexus.

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

    Dan Williams
     
  • If discovery returns 0 for target_port_protocols but shows an attached
    sata device, just report SAS_PROTOCOL_SATA in the identify data so
    userspace can reliably search for sata devices in the domain.

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

    Dan Williams
     
  • Before:
    $ cat /sys/class/sas_phy/phy-6\:3/device_type
    none
    $ cat /sys/class/sas_phy/phy-6\:3/target_port_protocols
    none

    After:
    $ cat /sys/class/sas_phy/phy-6\:3/device_type
    end device
    $ cat /sys/class/sas_phy/phy-6\:3/target_port_protocols
    sata

    Also downgrade the phy_list_lock to _irq instead of _irqsave since
    libsas will never call sas_get_port_device with interrupts disbled.

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

    Dan Williams
     
  • 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
     
  • Until all sas_tasks are known to no longer be in-flight this flag gates late
    completions from colliding with error handling. However, it must be cleared
    prior to the submission of scsi_send_eh_cmnd() requests, otherwise those
    commands will never be completed correctly.

    This was spotted by slub debug:
    =============================================================================
    BUG sas_task: Objects remaining on kmem_cache_close()
    -----------------------------------------------------------------------------

    INFO: Slab 0xffffea001f0eba00 objects=34 used=1 fp=0xffff8807c3aecb00 flags=0x8000000000004080
    Pid: 22919, comm: modprobe Not tainted 3.2.0-isci+ #2
    Call Trace:
    [] slab_err+0xb0/0xd2
    [] ? free_percpu+0x31/0x117
    [] ? kzalloc+0x14/0x16
    [] ? kzalloc+0x14/0x16
    [] kmem_cache_destroy+0x11d/0x270
    [] sas_class_exit+0x10/0x12 [libsas]
    [] sys_delete_module+0x1c4/0x23c
    [] ? sysret_check+0x2e/0x69
    [] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [] system_call_fastpath+0x16/0x1b
    INFO: Object 0xffff8807c3aed280 @offset=21120
    INFO: Allocated in sas_alloc_task+0x22/0x90 [libsas] age=4615311 cpu=2 pid=12966
    __slab_alloc.clone.3+0x1d1/0x234
    kmem_cache_alloc+0x52/0x10d
    sas_alloc_task+0x22/0x90 [libsas]
    sas_queuecommand+0x20e/0x230 [libsas]
    scsi_send_eh_cmnd+0xd1/0x30c
    scsi_eh_try_stu+0x4f/0x6b
    scsi_eh_ready_devs+0xba/0x6ef
    sas_scsi_recover_host+0xa35/0xab1 [libsas]
    scsi_error_handler+0x14b/0x5fa
    kthread+0x9d/0xa5
    kernel_thread_helper+0x4/0x10

    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
     
  • If the phy is attached to a new sas address unregister the first address
    before processing the new attachment.

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

    Dan Williams