1. 18 5月, 2018 1 次提交
  2. 15 5月, 2018 2 次提交
  3. 08 5月, 2018 1 次提交
    • J
      scsi: zfcp: fix infinite iteration on ERP ready list · fa89adba
      Jens Remus 提交于
      zfcp_erp_adapter_reopen() schedules blocking of all of the adapter's
      rports via zfcp_scsi_schedule_rports_block() and enqueues a reopen
      adapter ERP action via zfcp_erp_action_enqueue(). Both are separately
      processed asynchronously and concurrently.
      
      Blocking of rports is done in a kworker by zfcp_scsi_rport_work(). It
      calls zfcp_scsi_rport_block(), which then traces a DBF REC "scpdely" via
      zfcp_dbf_rec_trig().  zfcp_dbf_rec_trig() acquires the DBF REC spin lock
      and then iterates with list_for_each() over the adapter's ERP ready list
      without holding the ERP lock. This opens a race window in which the
      current list entry can be moved to another list, causing list_for_each()
      to iterate forever on the wrong list, as the erp_ready_head is never
      encountered as terminal condition.
      
      Meanwhile the ERP action can be processed in the ERP thread by
      zfcp_erp_thread(). It calls zfcp_erp_strategy(), which acquires the ERP
      lock and then calls zfcp_erp_action_to_running() to move the ERP action
      from the ready to the running list.  zfcp_erp_action_to_running() can
      move the ERP action using list_move() just during the aforementioned
      race window. It then traces a REC RUN "erator1" via zfcp_dbf_rec_run().
      zfcp_dbf_rec_run() tries to acquire the DBF REC spin lock. If this is
      held by the infinitely looping kworker, it effectively spins forever.
      
      Example Sequence Diagram:
      
      Process                ERP Thread             rport_work
      -------------------    -------------------    -------------------
      zfcp_erp_adapter_reopen()
      zfcp_erp_adapter_block()
      zfcp_scsi_schedule_rports_block()
      lock ERP                                      zfcp_scsi_rport_work()
      zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER)
      list_add_tail() on ready                      !(rport_task==RPORT_ADD)
      wake_up() ERP thread                          zfcp_scsi_rport_block()
      zfcp_dbf_rec_trig()    zfcp_erp_strategy()    zfcp_dbf_rec_trig()
      unlock ERP                                    lock DBF REC
      zfcp_erp_wait()        lock ERP
      |                      zfcp_erp_action_to_running()
      |                                             list_for_each() ready
      |                      list_move()              current entry
      |                        ready to running
      |                      zfcp_dbf_rec_run()       endless loop over running
      |                      zfcp_dbf_rec_run_lvl()
      |                      lock DBF REC spins forever
      
      Any adapter recovery can trigger this, such as setting the device offline
      or reboot.
      
      V4.9 commit 4eeaa4f3 ("zfcp: close window with unblocked rport
      during rport gone") introduced additional tracing of (un)blocking of
      rports. It missed that the adapter->erp_lock must be held when calling
      zfcp_dbf_rec_trig().
      
      This fix uses the approach formerly introduced by commit aa0fec62
      ("[SCSI] zfcp: Fix sparse warning by providing new entry in dbf") that got
      later removed by commit ae0904f6 ("[SCSI] zfcp: Redesign of the debug
      tracing for recovery actions.").
      
      Introduce zfcp_dbf_rec_trig_lock(), a wrapper for zfcp_dbf_rec_trig() that
      acquires and releases the adapter->erp_lock for read.
      Reported-by: NSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: NJens Remus <jremus@linux.ibm.com>
      Fixes: 4eeaa4f3 ("zfcp: close window with unblocked rport during rport gone")
      Cc: <stable@vger.kernel.org> # 2.6.32+
      Reviewed-by: NBenjamin Block <bblock@linux.vnet.ibm.com>
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      fa89adba
  4. 02 5月, 2018 2 次提交
  5. 21 4月, 2018 3 次提交
    • B
      scsi: target: Fix fortify_panic kernel exception · f5957dad
      Bryant G Ly 提交于
      memcmp() requires the two buffers passed as arguments to be at least
      'size' bytes long, otherwise a fortify_panic will trigger.
      
      Use memchr_inv() instead of memcmp() to determine whether the received
      payload is zeroed or not.
      
      The bug was found by running a block backstore via LIO.
      
      [  496.212958] Call Trace:
      [  496.212960] [c0000007e58e3800] [c000000000cbbefc] fortify_panic+0x24/0x38 (unreliable)
      [  496.212965] [c0000007e58e3860] [d00000000f150c28] iblock_execute_write_same+0x3b8/0x3c0 [target_core_iblock]
      [  496.212976] [c0000007e58e3910] [d000000006c737d4] __target_execute_cmd+0x54/0x150 [target_core_mod]
      [  496.212982] [c0000007e58e3940] [d000000006d32ce4] ibmvscsis_write_pending+0x74/0xe0 [ibmvscsis]
      [  496.212991] [c0000007e58e39b0] [d000000006c74fc8] transport_generic_new_cmd+0x318/0x370 [target_core_mod]
      [  496.213001] [c0000007e58e3a30] [d000000006c75084] transport_handle_cdb_direct+0x64/0xd0 [target_core_mod]
      [  496.213011] [c0000007e58e3aa0] [d000000006c75298] target_submit_cmd_map_sgls+0x1a8/0x320 [target_core_mod]
      [  496.213021] [c0000007e58e3b30] [d000000006c75458] target_submit_cmd+0x48/0x60 [target_core_mod]
      [  496.213026] [c0000007e58e3bd0] [d000000006d34c20] ibmvscsis_scheduler+0x370/0x600 [ibmvscsis]
      [  496.213031] [c0000007e58e3c90] [c00000000013135c] process_one_work+0x1ec/0x580
      [  496.213035] [c0000007e58e3d20] [c000000000131798] worker_thread+0xa8/0x600
      [  496.213039] [c0000007e58e3dc0] [c00000000013a468] kthread+0x168/0x1b0
      [  496.213044] [c0000007e58e3e30] [c00000000000b528] ret_from_kernel_thread+0x5c/0xb4
      
      [mkp: tweaked commit message]
      
      Fixes: 2237498f ("target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout")
      Signed-off-by: NBryant G. Ly <bryantly@linux.vnet.ibm.com>
      Reviewed-by: NSteven Royer <seroyer@linux.vnet.ibm.com>
      Tested-by: NTaylor Jakobson <tjakobs@us.ibm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: <stable@vger.kernel.org> # v4.13+
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      f5957dad
    • C
      scsi: isci: Fix infinite loop in while loop · 4bc83b3f
      Colin Ian King 提交于
      In the case when the phy_mask is bitwise anded with the phy_index bit is
      zero the continue statement currently jumps to the next iteration of the
      while loop and phy_index is never actually incremented, potentially
      causing an infinite loop if phy_index is less than SCI_MAX_PHS. Fix this
      by turning the while loop into a for loop.
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4bc83b3f
    • L
      scsi: storvsc: Set up correct queue depth values for IDE devices · f286299c
      Long Li 提交于
      Unlike SCSI and FC, we don't use multiple channels for IDE.  Also fix
      the calculation for sub-channels.
      Signed-off-by: NLong Li <longli@microsoft.com>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      f286299c
  6. 19 4月, 2018 9 次提交
  7. 13 4月, 2018 8 次提交
  8. 12 4月, 2018 14 次提交