You need to sign in or sign up before continuing.
  1. 03 12月, 2015 1 次提交
  2. 10 11月, 2015 4 次提交
  3. 06 11月, 2015 1 次提交
  4. 27 10月, 2015 1 次提交
  5. 29 8月, 2015 1 次提交
  6. 16 7月, 2015 1 次提交
  7. 04 12月, 2014 1 次提交
  8. 24 11月, 2014 2 次提交
  9. 12 11月, 2014 1 次提交
  10. 16 9月, 2014 2 次提交
    • S
      scsi: balance out autopm get/put calls in scsi_sysfs_add_sdev() · 6fe8c1db
      Subhash Jadavani 提交于
      SCSI Well-known logical units generally don't have any scsi driver
      associated with it which means no one will call scsi_autopm_put_device()
      on these wlun scsi devices and this would result in keeping the
      corresponding scsi device always active (hence LLD can't be suspended as
      well). Same exact problem can be seen for other scsi device representing
      normal logical unit whose driver is yet to be loaded. This patch fixes
      the above problem with this approach:
      
      - make the scsi_autopm_put_device call at the end of scsi_sysfs_add_sdev
        to make it balance out the get earlier in the function.
      - let drivers do paired get/put calls in their probe methods.
      Signed-off-by: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      6fe8c1db
    • 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
  11. 09 8月, 2014 1 次提交
  12. 26 7月, 2014 2 次提交
    • 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
  13. 25 7月, 2014 2 次提交
  14. 18 7月, 2014 1 次提交
  15. 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
  16. 20 3月, 2014 1 次提交
  17. 16 3月, 2014 2 次提交
  18. 08 2月, 2014 1 次提交
  19. 14 1月, 2014 1 次提交
  20. 11 1月, 2014 1 次提交
  21. 19 12月, 2013 1 次提交
    • R
      [SCSI] Set the minimum valid value of 'eh_deadline' as 0 · bb3b621a
      Ren Mingxin 提交于
      The former minimum valid value of 'eh_deadline' is 1s, which means
      the earliest occasion to shorten EH is 1 second later since a
      command is failed or timed out. But if we want to skip EH steps
      ASAP, we have to wait until the first EH step is finished. If the
      duration of the first EH step is long, this waiting time is
      excruciating. So, it is necessary to accept 0 as the minimum valid
      value for 'eh_deadline'.
      
      According to my test, with Hannes' patchset 'New EH command timeout
      handler' as well, the minimum IO time is improved from 73s
      (eh_deadline = 1) to 43s(eh_deadline = 0) when commands are timed
      out by disabling RSCN and target port.
      Signed-off-by: NRen Mingxin <renmx@cn.fujitsu.com>
      Signed-off-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      bb3b621a
  22. 25 10月, 2013 2 次提交
  23. 26 8月, 2013 1 次提交
    • E
      [SCSI] Generate uevents on certain unit attention codes · 279afdfe
      Ewan D. Milne 提交于
      Generate a uevent when the following Unit Attention ASC/ASCQ
      codes are received:
      
          2A/01  MODE PARAMETERS CHANGED
          2A/09  CAPACITY DATA HAS CHANGED
          38/07  THIN PROVISIONING SOFT THRESHOLD REACHED
          3F/03  INQUIRY DATA HAS CHANGED
          3F/0E  REPORTED LUNS DATA HAS CHANGED
      
      Log kernel messages when the following Unit Attention ASC/ASCQ
      codes are received that are not as specific as those above:
      
          2A/xx  PARAMETERS CHANGED
          3F/xx  TARGET OPERATING CONDITIONS HAVE CHANGED
      
      Added logic to set expecting_lun_change for other LUNs on the target
      after REPORTED LUNS DATA HAS CHANGED is received, so that duplicate
      uevents are not generated, and clear expecting_lun_change when a
      REPORT LUNS command completes, in accordance with the SPC-3
      specification regarding reporting of the 3F 0E ASC/ASCQ UA.
      
      [jejb: remove SPC3 test in scsi_report_lun_change and some docbook fixes and
             unused variable fix, both reported by Fengguang Wu]
      Signed-off-by: NEwan D. Milne <emilne@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      279afdfe
  24. 05 6月, 2013 1 次提交
  25. 30 11月, 2012 1 次提交
    • S
      [SCSI] prevent stack buffer overflow in host_reset · 072f19b4
      Sasha Levin 提交于
      store_host_reset() has tried to re-invent the wheel to compare sysfs strings.
      Unfortunately it did so poorly and never bothered to check the input from
      userspace before overwriting stack with it, so something simple as:
      
      echo "WoopsieWoopsie" >
      /sys/devices/pseudo_0/adapter0/host0/scsi_host/host0/host_reset
      
      would result in:
      
      [  316.310101] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff81f5bac7
      [  316.310101]
      [  316.320051] Pid: 6655, comm: sh Tainted: G        W    3.7.0-rc5-next-20121114-sasha-00016-g5c9d68d-dirty #129
      [  316.320051] Call Trace:
      [  316.340058] pps pps0: PPS event at 1352918752.620355751
      [  316.340062] pps pps0: capture assert seq #303
      [  316.320051]  [<ffffffff83b3856b>] panic+0xcd/0x1f4
      [  316.320051]  [<ffffffff81f5bac7>] ? store_host_reset+0xd7/0x100
      [  316.320051]  [<ffffffff8110b996>] __stack_chk_fail+0x16/0x20
      [  316.320051]  [<ffffffff81f5bac7>] store_host_reset+0xd7/0x100
      [  316.320051]  [<ffffffff81e55bb3>] dev_attr_store+0x13/0x30
      [  316.320051]  [<ffffffff812f7db1>] sysfs_write_file+0x101/0x170
      [  316.320051]  [<ffffffff8127acc8>] vfs_write+0xb8/0x180
      [  316.320051]  [<ffffffff8127ae80>] sys_write+0x50/0xa0
      [  316.320051]  [<ffffffff83c03418>] tracesys+0xe1/0xe6
      
      Fix this by uninventing whatever was going on there and just use sysfs_streq.
      
      Bug introduced by 29443691 ("[SCSI] scsi: Added support for adapter and
      firmware reset").
      
      [jejb: added necessary const to prevent compile warnings]
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: <stable@vger.kernel.org> #3.2+
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      072f19b4
  26. 24 9月, 2012 1 次提交
  27. 20 7月, 2012 4 次提交
    • D
      [SCSI] fix hot unplug vs async scan race · 3b661a92
      Dan Williams 提交于
      The following crash results from cases where the end_device has been
      removed before scsi_sysfs_add_sdev has had a chance to run.
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
       IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6
       ...
       Call Trace:
        [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3
        [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf
        [<ffffffff8125e641>] kobject_add_varg+0x41/0x50
        [<ffffffff8125e70b>] kobject_add+0x64/0x66
        [<ffffffff8131122b>] device_add+0x12d/0x63a
        [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56
        [<ffffffff8107de15>] ? module_refcount+0x89/0xa0
        [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a
        [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145
      
      ...teach scsi_sysfs_add_devices() to check for deleted devices() before
      trying to add them, and teach scsi_remove_target() how to remove targets
      that have not been added via device_add().
      
      Cc: <stable@vger.kernel.org>
      Reported-by: NDariusz Majchrzak <dariusz.majchrzak@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      3b661a92
    • B
      [SCSI] Stop accepting SCSI requests before removing a device · b485462a
      Bart Van Assche 提交于
      Avoid that the code for requeueing SCSI requests triggers a
      crash by making sure that that code isn't scheduled anymore
      after a device has been removed.
      
      Also, source code inspection of __scsi_remove_device() revealed
      a race condition in this function: no new SCSI requests must be
      accepted for a SCSI device after device removal started.
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Reviewed-by: NMike Christie <michaelc@cs.wisc.edu>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      b485462a
    • B
      [SCSI] Fix device removal NULL pointer dereference · 67bd9413
      Bart Van Assche 提交于
      Use blk_queue_dead() to test whether the queue is dead instead
      of !sdev. Since scsi_prep_fn() may be invoked concurrently with
      __scsi_remove_device(), keep the queuedata (sdev) pointer in
      __scsi_remove_device(). This patch fixes a kernel oops that
      can be triggered by USB device removal. See also
      http://www.spinics.net/lists/linux-scsi/msg56254.html.
      
      Other changes included in this patch:
      - Swap the blk_cleanup_queue() and kfree() calls in
        scsi_host_dev_release() to make that code easier to grasp.
      - Remove the queue dead check from scsi_run_queue() since the
        queue state can change anyway at any point in that function
        where the queue lock is not held.
      - Remove the queue dead check from the start of scsi_request_fn()
        since it is redundant with the scsi_device_online() check.
      Reported-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Reviewed-by: NMike Christie <michaelc@cs.wisc.edu>
      Reviewed-by: NTejun Heo <tj@kernel.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      67bd9413
    • M
      [SCSI] add new SDEV_TRANSPORT_OFFLINE state · 1b8d2620
      Mike Christie 提交于
      This patch adds a new state SDEV_TRANSPORT_OFFLINE. It will
      be used by transport classes to offline devices for cases like
      when the fast_io_fail/recovery_tmo fires. In those cases we
      want all IO to fail, and we have not yet escalated to dev_loss_tmo
      behavior where we are removing the devices.
      
      Currently to handle this state, transport classes are setting
      the scsi_device's state to running, setting their internal
      session/port structs state to something that indicates failed,
      and then failing IO from some transport check in the queuecommand.
      
      The reason for the new value is so that users can distinguish
      between a device failure that is a result of a transport problem
      vs the wide range of errors that devices get offlined for
      when a scsi command times out and we offline the devices there.
      It also fixes the confusion as to why the transport class is
      failing IO, but has set the device state from blocked to running.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      1b8d2620
  28. 27 8月, 2011 1 次提交