1. 20 Jun, 2019 9 commits
    • Ondrej Zary's avatar
      scsi: wd719x: Fix resets and aborts · 5da1faa0
      Ondrej Zary authored
      Host reset oopses because it calls wd719x_chip_init, which calls
      request_firmware, under a spinlock. Stop the RISC first, then flush active
      SCBs under a spinlock. Finally call wd719x_chip_init unlocked.
      
      Also found and fixed more bugs during tests:
      
      Affected active SCBs were not flushed during abort, bus and device
      reset. This caused problems in a following host reset (hang or oops).
      
      Device and bus reset failed under load because the result of the reset
      command is WD719X_SUE_TERM or WD719X_SUE_RESET. Don't treat these codes as
      error in wd719x_wait_done.
      
      wd719x_direct_cmd for RESET/ABORT commands didn't work properly, causing
      timeouts. Looks like it was caused by the WD719X_DISABLE_INT bit. Not
      setting it for RESET/ABORT commands seems to fix the probem.  Also lower
      the log level of the corresponding "direct command completed" message to
      debug.
      
      Unfortunately, my documentation is missing some pages, including page
      67 (SPIDER67.gif) about resets :(
      Reported-by: default avatarHariprasad Kelam <hariprasad.kelam@gmail.com>
      Signed-off-by: default avatarOndrej Zary <linux@zary.sk>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      5da1faa0
    • Bart Van Assche's avatar
      scsi: RDMA/srp: Fix a sleep-in-invalid-context bug · fd561412
      Bart Van Assche authored
      The previous patch guarantees that srp_queuecommand() does not get
      invoked while reconnecting occurs. Hence remove the code from
      srp_queuecommand() that prevents command queueing while reconnecting.
      This patch avoids that the following can appear in the kernel log:
      
      BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
      in_atomic(): 1, irqs_disabled(): 0, pid: 5600, name: scsi_eh_9
      1 lock held by scsi_eh_9/5600:
       #0:  (rcu_read_lock){....}, at: [<00000000cbb798c7>] __blk_mq_run_hw_queue+0xf1/0x1e0
      Preemption disabled at:
      [<00000000139badf2>] __blk_mq_delay_run_hw_queue+0x78/0xf0
      CPU: 9 PID: 5600 Comm: scsi_eh_9 Tainted: G        W        4.15.0-rc4-dbg+ #1
      Hardware name: Dell Inc. PowerEdge R720/0VWT90, BIOS 2.5.4 01/22/2016
      Call Trace:
       dump_stack+0x67/0x99
       ___might_sleep+0x16a/0x250 [ib_srp]
       __mutex_lock+0x46/0x9d0
       srp_queuecommand+0x356/0x420 [ib_srp]
       scsi_dispatch_cmd+0xf6/0x3f0
       scsi_queue_rq+0x4a8/0x5f0
       blk_mq_dispatch_rq_list+0x73/0x440
       blk_mq_sched_dispatch_requests+0x109/0x1a0
       __blk_mq_run_hw_queue+0x131/0x1e0
       __blk_mq_delay_run_hw_queue+0x9a/0xf0
       blk_mq_run_hw_queue+0xc0/0x1e0
       blk_mq_start_hw_queues+0x2c/0x40
       scsi_run_queue+0x18e/0x2d0
       scsi_run_host_queues+0x22/0x40
       scsi_error_handler+0x18d/0x5f0
       kthread+0x11c/0x140
       ret_from_fork+0x24/0x30
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarLaurence Oberman <loberman@redhat.com>
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Leon Romanovsky <leonro@mellanox.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      fd561412
    • Bart Van Assche's avatar
      scsi: Avoid that .queuecommand() gets called for a blocked SCSI device · bbe9fb0d
      Bart Van Assche authored
      Several SCSI transport and LLD drivers surround code that does not
      tolerate concurrent calls of .queuecommand() with scsi_target_block() /
      scsi_target_unblock(). These last two functions use
      blk_mq_quiesce_queue() / blk_mq_unquiesce_queue() for scsi-mq request
      queues to prevent concurrent .queuecommand() calls. However, that is
      not sufficient to prevent .queuecommand() calls from scsi_send_eh_cmnd().
      Hence surround the .queuecommand() call from the SCSI error handler with
      code that avoids that .queuecommand() gets called in the blocked state.
      
      Note: converting the .queuecommand() call in scsi_send_eh_cmnd() into
      code that calls blk_get_request() + blk_execute_rq() is not an option
      since scsi_send_eh_cmnd() must be able to make forward progress even
      if all requests have been allocated.
      
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      bbe9fb0d
    • Bart Van Assche's avatar
      scsi: Restrict user space SCSI device state changes to "running" and "offline" · ac88c1f6
      Bart Van Assche authored
      The ability to modify the SCSI device state was introduced by commit
      638127e5 ("[PATCH] Fix error handler offline behaviour"; v2.6.12). That
      same commit introduced the following device states:
      
             { SDEV_CREATED, "created" },
             { SDEV_RUNNING, "running" },
             { SDEV_CANCEL,  "cancel"  },
             { SDEV_DEL,     "deleted" },
             { SDEV_QUIESCE, "quiesce" },
             { SDEV_OFFLINE, "offline" },
      
      The SDEV_BLOCK state was introduced later to avoid that an FC cable pull
      would immediately result in an I/O error (commit 1094e682; "[PATCH]
      suspending I/Os to a device"; v2.6.12). That same patch introduced the
      ability to set the SDEV_BLOCK state from user space. I'm not sure whether
      that ability was introduced on purpose or accidentally.
      
      Since there is agreement that only writing "running" or "offline" into
      the SCSI sysfs device state attribute makes sense, restrict sysfs writes
      to these values.
      
      This patch makes sure that SDEV_BLOCK is only used for its original
      purpose, namely to allow transport drivers and LLDs to block further
      .queuecommand() calls while transport layer or adapter recovery is in
      progress.
      
      Note: a web search for "/sys/class/scsi_device" AND "device/state"
      revealed several storage configuration guides. The instructions I found
      in these guides tell users to write the value "running" or "offline" in
      the SCSI device state sysfs attribute and no other values.
      
      [mkp: typo]
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Cc: James Smart <james.smart@broadcom.com>
      Cc: Ewan D. Milne <emilne@redhat.com>
      Cc: Laurence Oberman <loberman@redhat.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      ac88c1f6
    • Varun Prakash's avatar
      scsi: cxgb4i: add support for IEEE_8021QAZ_APP_SEL_STREAM selector · 152e30fc
      Varun Prakash authored
      IEEE_8021QAZ_APP_SEL_STREAM is a valid selector for iSCSI connections, so
      add code to use IEEE_8021QAZ_APP_SEL_STREAM selector to get priority mask.
      Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      152e30fc
    • Christophe JAILLET's avatar
      scsi: tcmu: Simplify tcmu_update_uio_info() · 22c2f35f
      Christophe JAILLET authored
      Use 'kasprintf()' instead of:
         - snprintf(NULL, 0...
         - kmalloc(...
         - snprintf(...
      
      This is less verbose and saves 7 bytes (i.e. the space for '/(null)') if
      'udev->dev_config' is NULL.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      22c2f35f
    • Branden Bonaby's avatar
      scsi: storvsc: Add ability to change scsi queue depth · adfbd028
      Branden Bonaby authored
      Adding functionality to allow the SCSI queue depth to be changed by
      utilizing the "scsi_change_queue_depth" function.
      
      [mkp: checkpatch]
      Signed-off-by: default avatarBranden Bonaby <brandonbonaby94@gmail.com>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      adfbd028
    • Gustavo A. R. Silva's avatar
      scsi: mpt3sas: Mark expected switch fall-through · 6ea3b189
      Gustavo A. R. Silva authored
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
      we are expecting to fall through.
      
      This patch fixes the following warning:
      
      drivers/scsi/mpt3sas/mpt3sas_base.c: In function  _base_update_ioc_page1_inlinewith_perf_mode :
      drivers/scsi/mpt3sas/mpt3sas_base.c:4510:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (ioc->high_iops_queues) {
            ^
      drivers/scsi/mpt3sas/mpt3sas_base.c:4530:2: note: here
        case MPT_PERF_MODE_LATENCY:
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
      
      Fixes: 30cb97023f38 ("scsi: mpt3sas: Introduce perf_mode module parameter")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      6ea3b189
    • John Garry's avatar
      scsi: libsas: aic94xx: hisi_sas: mvsas: pm8001: Use dev_is_expander() · 924a3541
      John Garry authored
      Many times in libsas, and in LLDDs which use libsas, the check for an
      expander device is re-implemented or open coded.
      
      Use dev_is_expander() instead. We rename this from
      sas_dev_type_is_expander() to not spill so many lines in referencing.
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
      Reviewed-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      924a3541
  2. 18 Jun, 2019 31 commits