1. 06 Apr, 2017 8 commits
  2. 05 Apr, 2017 2 commits
  3. 04 Apr, 2017 1 commit
    • Arnd Bergmann's avatar
      scsi: advansys: fix uninitialized data access · 44a5b977
      Arnd Bergmann authored
      gcc-7.0.1 now warns about a previously unnoticed access of uninitialized
      struct members:
      
      drivers/scsi/advansys.c: In function 'AscMsgOutSDTR':
      drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
               ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
                                ^
      drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      The code has existed in this exact form at least since v2.6.12, and the
      warning seems correct. This uses named initializers to ensure we
      initialize all members of the structure.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      44a5b977
  4. 30 Mar, 2017 12 commits
  5. 28 Mar, 2017 13 commits
  6. 23 Mar, 2017 4 commits
    • Brian King's avatar
      16a20b52
    • Brian King's avatar
      scsi: ipr: Fix SATA EH hang · ef97d8ae
      Brian King authored
      This patch fixes a hang that can occur in ATA EH with ipr. With ipr's
      usage of libata, commands should never end up on ap->eh_done_q. The
      timeout function we use for ipr, even for SATA devices, is
      scsi_times_out, so ATA_QCFLAG_EH_SCHEDULED never gets set for ipr and EH
      is driven completely by ipr and SCSI. The SCSI EH thread ends up calling
      ipr's eh_device_reset_handler, which then calls
      ata_std_error_handler. This ends up calling ipr_sata_reset, which issues
      a reset to the device. This should result in all pending commands
      getting failed back and having ata_qc_complete called for them, which
      should end up clearing ATA_QCFLAG_FAILED as qc->flags gets zeroed in
      ata_qc_free.  This ensures that when we end up in ata_eh_finish, we
      don't do anything more with the command.
      
      On adapters that only support a single interrupt and when running with
      two MSI-X vectors or less, the adapter firmware guarantees that
      responses to all outstanding commands are sent back prior to sending the
      response to the SATA reset command.  On newer adapters supporting
      multiple HRRQs, however, this can no longer be guaranteed, since the
      command responses and reset response may be processed on different
      HRRQs.
      
      If ipr returns from ipr_sata_reset before the outstanding command was
      returned, this sends us down the path of __ata_eh_qc_complete which then
      moves the associated scsi_cmd from the work_q in
      scsi_eh_bus_device_reset to ap->eh_done_q, which then will sit there
      forever and we will be wedged.
      
      This patch fixes this up by ensuring that any outstanding commands are
      flushed before returning from eh_device_reset_handler for a SATA device.
      Reported-by: default avatarDavid Jeffery <djeffery@redhat.com>
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Reviewed-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Tested-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      ef97d8ae
    • Brian King's avatar
      scsi: ipr: Error path locking fixes · f646f325
      Brian King authored
      This patch closes up some potential race conditions observed in the
      error handling paths in ipr while debugging an issue resulting in a hang
      with SATA error handling. These patches ensure we are holding the
      correct lock when adding and removing commands from the free and pending
      queues in some error scenarios.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Reviewed-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Tested-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      f646f325
    • Brian King's avatar
      scsi: ipr: Fix abort path race condition · 439ae285
      Brian King authored
      This fixes a race condition in the error handlomg paths of ipr. While a
      command is outstanding to the adapter, it is placed on a pending queue
      for the hrrq it is associated with, while holding the HRRQ lock. When a
      command is completed, it is removed from the pending queue, under HRRQ
      lock, and placed on a local list.  This list is then iterated through
      without any locks and each command's done function is invoked, inside of
      which, the command gets returned to the free list while grabbing the
      HRRQ lock. This fixes two race conditions when commands have been
      removed from the pending list but have not yet been added to the free
      list. Both of these changes fix race conditions that could result in
      returning success from eh_abort_handler and then later calling scsi_done
      for the same request.
      
      The first race condition is in ipr_cancel_op. It looks through each
      pending queue to see if the command to be aborted is still outstanding
      or not. Rather than looking on the pending queue, reverse the logic to
      check to look for commands that are NOT on the free queue.  The second
      race condition can occur when in ipr_wait_for_ops where we are waiting
      for responses for commands we've aborted.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Reviewed-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Tested-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      439ae285