1. 30 3月, 2016 1 次提交
  2. 11 3月, 2016 1 次提交
  3. 06 3月, 2016 3 次提交
  4. 12 2月, 2016 1 次提交
    • J
      scsi: fix soft lockup in scsi_remove_target() on module removal · 90a88d6e
      James Bottomley 提交于
      This softlockup is currently happening:
      
      [  444.088002] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [kworker/1:1:29]
      [  444.088002] Modules linked in: lpfc(-) qla2x00tgt(O) qla2xxx_scst(O) scst_vdisk(O) scsi_transport_fc libcrc32c scst(O) dlm configfs nfsd lockd grace nfs_acl auth_rpcgss sunrpc ed
      d snd_pcm_oss snd_mixer_oss snd_seq snd_seq_device dm_mod iTCO_wdt snd_hda_codec_realtek snd_hda_codec_generic gpio_ich iTCO_vendor_support ppdev snd_hda_intel snd_hda_codec snd_hda
      _core snd_hwdep tg3 snd_pcm snd_timer libphy lpc_ich parport_pc ptp acpi_cpufreq snd pps_core fjes parport i2c_i801 ehci_pci tpm_tis tpm sr_mod cdrom soundcore floppy hwmon sg 8250_
      fintek pcspkr i915 drm_kms_helper uhci_hcd ehci_hcd drm fb_sys_fops sysimgblt sysfillrect syscopyarea i2c_algo_bit usbcore button video usb_common fan ata_generic ata_piix libata th
      ermal
      [  444.088002] CPU: 1 PID: 29 Comm: kworker/1:1 Tainted: G           O    4.4.0-rc5-2.g1e923a3-default #1
      [  444.088002] Hardware name: FUJITSU SIEMENS ESPRIMO E           /D2164-A1, BIOS 5.00 R1.10.2164.A1               05/08/2006
      [  444.088002] Workqueue: fc_wq_4 fc_rport_final_delete [scsi_transport_fc]
      [  444.088002] task: f6266ec0 ti: f6268000 task.ti: f6268000
      [  444.088002] EIP: 0060:[<c07e7044>] EFLAGS: 00000286 CPU: 1
      [  444.088002] EIP is at _raw_spin_unlock_irqrestore+0x14/0x20
      [  444.088002] EAX: 00000286 EBX: f20d3800 ECX: 00000002 EDX: 00000286
      [  444.088002] ESI: f50ba800 EDI: f2146848 EBP: f6269ec8 ESP: f6269ec8
      [  444.088002]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      [  444.088002] CR0: 8005003b CR2: 08f96600 CR3: 363ae000 CR4: 000006d0
      [  444.088002] Stack:
      [  444.088002]  f6269eec c066b0f7 00000286 f2146848 f50ba808 f50ba800 f50ba800 f2146a90
      [  444.088002]  f2146848 f6269f08 f8f0a4ed f3141000 f2146800 f2146a90 f619fa00 00000040
      [  444.088002]  f6269f40 c026cb25 00000001 166c6392 00000061 f6757140 f6136340 00000004
      [  444.088002] Call Trace:
      [  444.088002]  [<c066b0f7>] scsi_remove_target+0x167/0x1c0
      [  444.088002]  [<f8f0a4ed>] fc_rport_final_delete+0x9d/0x1e0 [scsi_transport_fc]
      [  444.088002]  [<c026cb25>] process_one_work+0x155/0x3e0
      [  444.088002]  [<c026cde7>] worker_thread+0x37/0x490
      [  444.088002]  [<c027214b>] kthread+0x9b/0xb0
      [  444.088002]  [<c07e72c1>] ret_from_kernel_thread+0x21/0x40
      
      What appears to be happening is that something has pinned the target
      so it can't go into STARGET_DEL via final release and the loop in
      scsi_remove_target spins endlessly until that happens.
      
      The fix for this soft lockup is to not keep looping over a device that
      we've called remove on but which hasn't gone into DEL state.  This
      patch will retain a simplistic memory of the last target and not keep
      looping over it.
      Reported-by: NSebastian Herbszt <herbszt@gmx.de>
      Tested-by: NSebastian Herbszt <herbszt@gmx.de>
      Fixes: 40998193
      Cc: stable@vger.kernel.org
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      90a88d6e
  5. 03 12月, 2015 4 次提交
  6. 01 12月, 2015 1 次提交
  7. 20 11月, 2015 1 次提交
    • V
      scsi_sysfs: protect against double execution of __scsi_remove_device() · be821fd8
      Vitaly Kuznetsov 提交于
      On some host errors storvsc module tries to remove sdev by scheduling a job
      which does the following:
      
         sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun);
         if (sdev) {
             scsi_remove_device(sdev);
             scsi_device_put(sdev);
         }
      
      While this code seems correct the following crash is observed:
      
       general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
       RIP: 0010:[<ffffffff81169979>]  [<ffffffff81169979>] bdi_destroy+0x39/0x220
       ...
       [<ffffffff814aecdc>] ? _raw_spin_unlock_irq+0x2c/0x40
       [<ffffffff8127b7db>] blk_cleanup_queue+0x17b/0x270
       [<ffffffffa00b54c4>] __scsi_remove_device+0x54/0xd0 [scsi_mod]
       [<ffffffffa00b556b>] scsi_remove_device+0x2b/0x40 [scsi_mod]
       [<ffffffffa00ec47d>] storvsc_remove_lun+0x3d/0x60 [hv_storvsc]
       [<ffffffff81080791>] process_one_work+0x1b1/0x530
       ...
      
      The problem comes with the fact that many such jobs (for the same device)
      are being scheduled simultaneously. While scsi_remove_device() uses
      shost->scan_mutex and scsi_device_lookup() will fail for a device in
      SDEV_DEL state there is no protection against someone who did
      scsi_device_lookup() before we actually entered __scsi_remove_device(). So
      the whole scenario looks like that: two callers do simultaneous (or
      preemption happens) calls to scsi_device_lookup() ant these calls succeed
      for both of them, after that they try doing scsi_remove_device().
      shost->scan_mutex only serializes their calls to __scsi_remove_device()
      and we end up doing the cleanup path twice.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      be821fd8
  8. 10 11月, 2015 4 次提交
  9. 06 11月, 2015 1 次提交
  10. 27 10月, 2015 1 次提交
  11. 29 8月, 2015 1 次提交
  12. 16 7月, 2015 1 次提交
  13. 04 12月, 2014 1 次提交
  14. 24 11月, 2014 2 次提交
  15. 12 11月, 2014 1 次提交
  16. 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
  17. 09 8月, 2014 1 次提交
  18. 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
  19. 25 7月, 2014 2 次提交
  20. 18 7月, 2014 1 次提交
  21. 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
  22. 20 3月, 2014 1 次提交
  23. 16 3月, 2014 2 次提交
  24. 08 2月, 2014 1 次提交
  25. 14 1月, 2014 1 次提交
  26. 11 1月, 2014 1 次提交
  27. 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