1. 03 11月, 2015 1 次提交
    • B
      SCSI: Increase REPORT_LUNS timeout · b39c9a66
      Brian King 提交于
      This patch fixes an issue seen with an IBM 2145 (SVC) where, following an error
      injection test which results in paths going offline, when they came
      back online, the path would timeout the REPORT_LUNS issued during the
      scan. This timeout situation continued until retries were expired, resulting in
      falling back to a sequential LUN scan. Then, since the target responds
      with PQ=1, PDT=0 for all possible LUNs, due to the way the sequential
      LUN scan code works, we end up adding 512 LUNs for each target, when there
      is really only a small handful of LUNs that are actually present.
      
      This patch increases the timeout used on the REPORT_LUNS to 30 seconds.
      This patch solves the issue of 512 non existent LUNs showing up after
      this event.
      Signed-off-by: NBrian King <brking@linux.vnet.ibm.com>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b39c9a66
  2. 01 6月, 2015 1 次提交
  3. 25 5月, 2015 1 次提交
    • J
      scsi_scan: fix queue depth initialisation problem · ef10b169
      James Bottomley 提交于
      Currently we blindly use the value of cmd_per_lun as the initial setting for
      queue_depth.  This fails miserably (hangs the system) if it is zero, which is
      the default value for anything uninitialised in the template.  The net result
      is that every host template has to set a value for cmd_per_lun.  Instead, use
      a default value of 1 if the actual value is unset.  This should pave the way
      for removing cmd_per_lun from all the templates and eventually from SCSI
      itself.
      Signed-off-by: NJames Bottomley <JBottomley@Odin.com>
      ef10b169
  4. 28 4月, 2015 1 次提交
    • M
      SCSI: add 1024 max sectors black list flag · 35e9a9f9
      Mike Christie 提交于
      This works around a issue with qnap iscsi targets not handling large IOs
      very well.
      
      The target returns:
      
      VPD INQUIRY: Block limits page (SBC)
        Maximum compare and write length: 1 blocks
        Optimal transfer length granularity: 1 blocks
        Maximum transfer length: 4294967295 blocks
        Optimal transfer length: 4294967295 blocks
        Maximum prefetch, xdread, xdwrite transfer length: 0 blocks
        Maximum unmap LBA count: 8388607
        Maximum unmap block descriptor count: 1
        Optimal unmap granularity: 16383
        Unmap granularity alignment valid: 0
        Unmap granularity alignment: 0
        Maximum write same length: 0xffffffff blocks
        Maximum atomic transfer length: 0
        Atomic alignment: 0
        Atomic transfer length granularity: 0
      
      and it is *sometimes* able to handle at least one IO of size up to 8 MB. We
      have seen in traces where it will sometimes work, but other times it
      looks like it fails and it looks like it returns failures if we send
      multiple large IOs sometimes. Also it looks like it can return 2 different
      errors. It will sometimes send iscsi reject errors indicating out of
      resources or it will send invalid cdb illegal requests check conditions.
      And then when it sends iscsi rejects it does not seem to handle retries
      when there are command sequence holes, so I could not just add code to
      try and gracefully handle that error code.
      
      The problem is that we do not have a good contact for the company,
      so we are not able to determine under what conditions it returns
      which error and why it sometimes works.
      
      So, this patch just adds a new black list flag to set targets like this to
      the old max safe sectors of 1024. The max_hw_sectors changes added in 3.19
      caused this regression, so I also ccing stable.
      Reported-by: NChristian Hesse <list@eworm.de>
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Cc: stable@vger.kernel.org
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJames Bottomley <JBottomley@Odin.com>
      35e9a9f9
  5. 19 3月, 2015 1 次提交
  6. 24 1月, 2015 1 次提交
    • S
      block: support different tag allocation policy · ee1b6f7a
      Shaohua Li 提交于
      The libata tag allocation is using a round-robin policy. Next patch will
      make libata use block generic tag allocation, so let's add a policy to
      tag allocation.
      
      Currently two policies: FIFO (default) and round-robin.
      
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NShaohua Li <shli@fb.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      ee1b6f7a
  7. 09 1月, 2015 3 次提交
  8. 25 11月, 2014 1 次提交
  9. 24 11月, 2014 1 次提交
  10. 12 11月, 2014 4 次提交
  11. 01 10月, 2014 2 次提交
  12. 16 9月, 2014 1 次提交
    • A
      scsi: don't store LUN bits in CDB[1] for USB mass-storage devices · 50c4e964
      Alan Stern 提交于
      The SCSI specification requires that the second Command Data Byte
      should contain the LUN value in its high-order bits if the recipient
      device reports SCSI level 2 or below.  Nevertheless, some USB
      mass-storage devices use those bits for other purposes in
      vendor-specific commands.  Currently Linux has no way to send such
      commands, because the SCSI stack always overwrites the LUN bits.
      
      Testing shows that Windows 7 and XP do not store the LUN bits in the
      CDB when sending commands to a USB device.  This doesn't matter if the
      device uses the Bulk-Only or UAS transports (which virtually all
      modern USB mass-storage devices do), as these have a separate
      mechanism for sending the LUN value.
      
      Therefore this patch introduces a flag in the Scsi_Host structure to
      inform the SCSI midlayer that a transport does not require the LUN
      bits to be stored in the CDB, and it makes usb-storage set this flag
      for all devices using the Bulk-Only transport.  (UAS is handled by a
      separate driver, but it doesn't really matter because no SCSI-2 or
      lower device is at all likely to use UAS.)
      
      The patch also cleans up the code responsible for storing the LUN
      value by adding a bitflag to the scsi_device structure.  The test for
      whether to stick the LUN value in the CDB can be made when the device
      is probed, and stored for future use rather than being made over and
      over in the fast path.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NTiziano Bacocco <tiziano.bacocco@gmail.com>
      Acked-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      50c4e964
  13. 30 7月, 2014 1 次提交
  14. 26 7月, 2014 3 次提交
  15. 18 7月, 2014 6 次提交
  16. 11 4月, 2014 1 次提交
    • D
      scsi: async sd resume · 3c31b52f
      Dan Williams 提交于
      async_schedule() sd resume work to allow disks and other devices to
      resume in parallel.
      
      This moves the entirety of scsi_device resume to an async context to
      ensure that scsi_device_resume() remains ordered with respect to the
      completion of the start/stop command.  For the duration of the resume,
      new command submissions (that do not originate from the scsi-core) will
      be deferred (BLKPREP_DEFER).
      
      It adds a new ASYNC_DOMAIN_EXCLUSIVE(scsi_sd_pm_domain) as a container
      of these operations.  Like scsi_sd_probe_domain it is flushed at
      sd_remove() time to ensure async ops do not continue past the
      end-of-life of the sdev.  The implementation explicitly refrains from
      reusing scsi_sd_probe_domain directly for this purpose as it is flushed
      at the end of dpm_resume(), potentially defeating some of the benefit.
      Given sdevs are quiesced it is permissible for these resume operations
      to bleed past the async_synchronize_full() calls made by the driver
      core.
      
      We defer the resolution of which pm callback to call until
      scsi_dev_type_{suspend|resume} time and guarantee that the callback
      parameter is never NULL.  With this in place the type of resume
      operation is encoded in the async function identifier.
      
      There is a concern that async resume could trigger PSU overload.  In the
      enterprise, storage enclosures enforce staggered spin-up regardless of
      what the kernel does making async scanning safe by default.  Outside of
      that context a user can disable asynchronous scanning via a kernel
      command line or CONFIG_SCSI_SCAN_ASYNC.  Honor that setting when
      deciding whether to do resume asynchronously.
      
      Inspired by Todd's analysis and initial proposal [2]:
      https://01.org/suspendresume/blogs/tebrandt/2013/hard-disk-resume-optimization-simpler-approach
      
      Cc: Len Brown <len.brown@intel.com>
      Cc: Phillip Susi <psusi@ubuntu.com>
      [alan: bug fix and clean up suggestion]
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Suggested-by: NTodd Brandt <todd.e.brandt@linux.intel.com>
      [djbw: kick all resume work to the async queue]
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      3c31b52f
  17. 27 3月, 2014 1 次提交
    • H
      [SCSI] Add EVPD page 0x83 and 0x80 to sysfs · b3ae8780
      Hannes Reinecke 提交于
      EVPD page 0x83 is used to uniquely identify the device.
      So instead of having each and every program issue a separate
      SG_IO call to retrieve this information it does make far more
      sense to display it in sysfs.
      
      Some older devices (most notably tapes) will only report reliable
      information in page 0x80 (Unit Serial Number). So export this
      in the sysfs attribute 'vpd_pg80'.
      
      [jejb: checkpatch fix]
      [hare: attach after transport configure]
      [fengguang.wu@intel.com: spotted problems with the original now fixed]
      Signed-off-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      b3ae8780
  18. 16 3月, 2014 2 次提交
    • J
      [SCSI] dual scan thread bug fix · f2495e22
      James Bottomley 提交于
      In the highly unusual case where two threads are running concurrently through
      the scanning code scanning the same target, we run into the situation where
      one may allocate the target while the other is still using it.  In this case,
      because the reap checks for STARGET_CREATED and kills the target without
      reference counting, the second thread will do the wrong thing on reap.
      
      Fix this by reference counting even creates and doing the STARGET_CREATED
      check in the final put.
      Tested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org # delay backport for 2 months for field testing
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      f2495e22
    • J
      [SCSI] fix our current target reap infrastructure · e63ed0d7
      James Bottomley 提交于
      This patch eliminates the reap_ref and replaces it with a proper kref.
      On last put of this kref, the target is removed from visibility in
      sysfs.  The final call to scsi_target_reap() for the device is done from
      __scsi_remove_device() and only if the device was made visible.  This
      ensures that the target disappears as soon as the last device is gone
      rather than waiting until final release of the device (which is often
      too long).
      Reviewed-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org # delay backport by 2 months for field testing
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      e63ed0d7
  19. 25 6月, 2013 1 次提交
  20. 05 6月, 2013 1 次提交
  21. 24 9月, 2012 1 次提交
  22. 22 8月, 2012 1 次提交
    • J
      [SCSI] Fix 'Device not ready' issue on mpt2sas · 14216561
      James Bottomley 提交于
      This is a particularly nasty SCSI ATA Translation Layer (SATL) problem.
      
      SAT-2 says (section 8.12.2)
      
              if the device is in the stopped state as the result of
              processing a START STOP UNIT command (see 9.11), then the SATL
              shall terminate the TEST UNIT READY command with CHECK CONDITION
              status with the sense key set to NOT READY and the additional
              sense code of LOGICAL UNIT NOT READY, INITIALIZING COMMAND
              REQUIRED;
      
      mpt2sas internal SATL seems to implement this.  The result is very confusing
      standby behaviour (using hdparm -y).  If you suspend a drive and then send
      another command, usually it wakes up.  However, if the next command is a TEST
      UNIT READY, the SATL sees that the drive is suspended and proceeds to follow
      the SATL rules for this, returning NOT READY to all subsequent commands.  This
      means that the ordering of TEST UNIT READY is crucial: if you send TUR and
      then a command, you get a NOT READY to both back.  If you send a command and
      then a TUR, you get GOOD status because the preceeding command woke the drive.
      
      This bit us badly because
      
      commit 85ef06d1
      Author: Tejun Heo <tj@kernel.org>
      Date:   Fri Jul 1 16:17:47 2011 +0200
      
          block: flush MEDIA_CHANGE from drivers on close(2)
      
      Changed our ordering on TEST UNIT READY commands meaning that SATA drives
      connected to an mpt2sas now suspend and refuse to wake (because the mpt2sas
      SATL sees the suspend *before* the drives get awoken by the next ATA command)
      resulting in lots of failed commands.
      
      The standard is completely nuts forcing this inconsistent behaviour, but we
      have to work around it.
      
      The fix for this is twofold:
      
         1. Set the allow_restart flag so we wake the drive when we see it has been
            suspended
      
         2. Return all TEST UNIT READY status directly to the mid layer without any
            further error handling which prevents us causing error handling which
            may offline the device just because of a media check TUR.
      Reported-by: NMatthias Prager <linux@matthiasprager.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      14216561
  23. 20 7月, 2012 4 次提交