1. 23 1月, 2015 1 次提交
    • R
      scsi: always increment reference count · dc4515ea
      Rusty Russell 提交于
      James reported:
      > After e513cc1c module: Remove stop_machine from module unloading,
      > module_refcount() is returning (unsigned long)-1 when called from within
      > a routine that runs in module_exit.  This is confusing the scsi device
      > put code which is coded to detect a module_refcount() of zero for
      > running within a module exit routine and not try to do another
      > module_put.  The fix is to restore the original behaviour of
      > module_refcount() and return zero if we're running inside an exit
      > routine.
      
      The correct fix is to turn try_module_get() into __module_get(), and
      always do the module_put().
      Acked-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      dc4515ea
  2. 04 12月, 2014 2 次提交
  3. 25 11月, 2014 1 次提交
  4. 24 11月, 2014 1 次提交
  5. 12 11月, 2014 6 次提交
  6. 01 10月, 2014 1 次提交
  7. 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
  8. 16 8月, 2014 1 次提交
  9. 29 7月, 2014 1 次提交
  10. 26 7月, 2014 3 次提交
    • C
      scsi: update scsi_device_types · c6e4f191
      Christoph Hellwig 提交于
      Add two new device types, most importantly the zoned block device
      one.
      
      Split from an earlier patch by Hannes Reinecke.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c6e4f191
    • C
      scsi: add support for a blk-mq based I/O path. · d285203c
      Christoph Hellwig 提交于
      This patch adds support for an alternate I/O path in the scsi midlayer
      which uses the blk-mq infrastructure instead of the legacy request code.
      
      Use of blk-mq is fully transparent to drivers, although for now a host
      template field is provided to opt out of blk-mq usage in case any unforseen
      incompatibilities arise.
      
      In general replacing the legacy request code with blk-mq is a simple and
      mostly mechanical transformation.  The biggest exception is the new code
      that deals with the fact the I/O submissions in blk-mq must happen from
      process context, which slightly complicates the I/O completion handler.
      The second biggest differences is that blk-mq is build around the concept
      of preallocated requests that also include driver specific data, which
      in SCSI context means the scsi_cmnd structure.  This completely avoids
      dynamic memory allocations for the fast path through I/O submission.
      
      Due the preallocated requests the MQ code path exclusively uses the
      host-wide shared tag allocator instead of a per-LUN one.  This only
      affects drivers actually using the block layer provided tag allocator
      instead of their own.  Unlike the old path blk-mq always provides a tag,
      although drivers don't have to use it.
      
      For now the blk-mq path is disable by defauly and must be enabled using
      the "use_blk_mq" module parameter.  Once the remaining work in the block
      layer to make blk-mq more suitable for slow devices is complete I hope
      to make it the default and eventually even remove the old code path.
      
      Based on the earlier scsi-mq prototype by Nicholas Bellinger.
      
      Thanks to Bart Van Assche and Robert Elliot for testing, benchmarking and
      various sugestions and code contributions.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NWebb Scales <webbnh@hp.com>
      Acked-by: NJens Axboe <axboe@kernel.dk>
      Tested-by: NBart Van Assche <bvanassche@acm.org>
      Tested-by: NRobert Elliott <elliott@hp.com>
      d285203c
    • C
      scsi: fix the {host,target,device}_blocked counter mess · cd9070c9
      Christoph Hellwig 提交于
      Seems like these counters are missing any sort of synchronization for
      updates, as a over 10 year old comment from me noted.  Fix this by
      using atomic counters, and while we're at it also make sure they are
      in the same cacheline as the _busy counters and not needlessly stored
      to in every I/O completion.
      
      With the new model the _busy counters can temporarily go negative,
      so all the readers are updated to check for > 0 values.  Longer
      term every successful I/O completion will reset the counters to zero,
      so the temporarily negative values will not cause any harm.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NWebb Scales <webbnh@hp.com>
      Acked-by: NJens Axboe <axboe@kernel.dk>
      Tested-by: NBart Van Assche <bvanassche@acm.org>
      Tested-by: NRobert Elliott <elliott@hp.com>
      cd9070c9
  11. 25 7月, 2014 3 次提交
  12. 18 7月, 2014 5 次提交
  13. 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
  14. 27 3月, 2014 5 次提交
  15. 16 3月, 2014 2 次提交
  16. 19 12月, 2013 2 次提交
    • H
      [SCSI] Update documentation · 6ad55502
      Hannes Reinecke 提交于
      The documentation has gone out-of-sync, so update it to
      the current status.
      Signed-off-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      6ad55502
    • H
      [SCSI] improved eh timeout handler · e494f6a7
      Hannes Reinecke 提交于
      When a command runs into a timeout we need to send an 'ABORT TASK'
      TMF. This is typically done by the 'eh_abort_handler' LLDD callback.
      
      Conceptually, however, this function is a normal SCSI command, so
      there is no need to enter the error handler.
      
      This patch implements a new scsi_abort_command() function which
      invokes an asynchronous function scsi_eh_abort_handler() to
      abort the commands via the usual 'eh_abort_handler'.
      
      If abort succeeds the command is either retried or terminated,
      depending on the number of allowed retries. However, 'eh_eflags'
      records the abort, so if the retry would fail again the
      command is pushed onto the error handler without trying to
      abort it (again); it'll be cleared up from SCSI EH.
      
      [hare: smatch detected stray switch fixed]
      Signed-off-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      e494f6a7
  17. 25 10月, 2013 1 次提交
  18. 03 8月, 2013 1 次提交
  19. 27 6月, 2013 1 次提交
    • M
      [SCSI] sd: Update WRITE SAME heuristics · 66c28f97
      Martin K. Petersen 提交于
      SATA drives located behind a SAS controller would incorrectly receive
      WRITE SAME commands. Tweak the heuristics so that:
      
       - If REPORT SUPPORTED OPERATION CODES is provided we will use that to
         choose between WRITE SAME(16), WRITE SAME(10) and disabled. This also
         fixes an issue with the old code which would issue WRITE SAME(10)
         despite the command not being whitelisted in REPORT SUPPORTED
         OPERATION CODES.
      
       - If REPORT SUPPORTED OPERATION CODES is not provided we will fall back
         to WRITE SAME(10) unless the device has an ATA Information VPD page.
         The assumption is that a SATL which is smart enough to implement
         WRITE SAME would also provide REPORT SUPPORTED OPERATION CODES.
      
      To facilitate the new heuristics scsi_report_opcode() has been modified
      to so we can distinguish between "operation not supported" and "RSOC not
      supported".
      Reported-by: NH. Peter Anvin <hpa@zytor.com>
      Tested-by: NBernd Schubert <bernd.schubert@itwm.fraunhofer.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      66c28f97
  20. 14 11月, 2012 1 次提交