1. 09 Jan, 2017 1 commit
  2. 15 Apr, 2016 2 commits
  3. 11 Apr, 2016 1 commit
  4. 30 Mar, 2016 1 commit
  5. 11 Mar, 2016 1 commit
  6. 05 Mar, 2016 3 commits
  7. 12 Feb, 2016 1 commit
    • James Bottomley's avatar
      scsi: fix soft lockup in scsi_remove_target() on module removal · 90a88d6e
      James Bottomley authored
      
      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: default avatarSebastian Herbszt <herbszt@gmx.de>
      Tested-by: default avatarSebastian Herbszt <herbszt@gmx.de>
      Fixes: 40998193
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      90a88d6e
  8. 02 Dec, 2015 4 commits
  9. 30 Nov, 2015 1 commit
  10. 19 Nov, 2015 1 commit
    • Vitaly Kuznetsov's avatar
      scsi_sysfs: protect against double execution of __scsi_remove_device() · be821fd8
      Vitaly Kuznetsov authored
      
      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: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      be821fd8
  11. 10 Nov, 2015 2 commits
    • Peter Oberparleiter's avatar
      scsi_sysfs: Fix queue_ramp_up_period return code · 5cb9b40d
      Peter Oberparleiter authored
      
      Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period
      returns the value of that number instead of the number of bytes written.
      This behavior can confuse programs expecting POSIX write() semantics.
      Fix this by returning the number of bytes written instead.
      Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      5cb9b40d
    • Bart Van Assche's avatar
      scsi: Fix a bdi reregistration race · bf2cf3ba
      Bart Van Assche authored
      Unregister and reregister BDI devices in the proper order. This patch
      avoids that the following kernel warning can get triggered:
      
      WARNING: CPU: 7 PID: 203 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80()
      sysfs: cannot create duplicate filename '/devices/virtual/bdi/8:32'
      Workqueue: events_unbound async_run_entry_fn
      Call Trace:
      [<ffffffff814ff5a4>] dump_stack+0x4c/0x65
      [<ffffffff810746ba>] warn_slowpath_common+0x8a/0xc0
      [<ffffffff81074736>] warn_slowpath_fmt+0x46/0x50
      [<ffffffff81237ca8>] sysfs_warn_dup+0x68/0x80
      [<ffffffff81237d8e>] sysfs_create_dir_ns+0x7e/0x90
      [<ffffffff81291f58>] kobject_add_internal+0xa8/0x320
      [<ffffffff812923a0>] kobject_add+0x60/0xb0
      [<ffffffff8138c937>] device_add+0x107/0x5e0
      [<ffffffff8138d018>] device_create_groups_vargs+0xd8/0x100
      [<ffffffff8138d05c>] device_create_vargs+0x1c/0x20
      [<ffffffff8117f233>] bdi_register+0x63/0x2a0
      [<ffffffff8117f497>] bdi_register_dev+0x27/0x30
      [<ffffffff81281549>] add_disk+0x1a9/0x4e0
      [<ffffffffa00c5739>] sd_probe_async+0x119/0x1d0 [sd_mod]
      [<ffffffff8109a81a>] async_run_entry_fn+0x4a/0x140
      [<ffffffff81091078>] process_one_work+0x1d8/0x7c0
      [<ffffffff81091774>] worker_thread+0x114/0x460
      [<ffffffff81097878>] kthread+0xf8/0x110
      [<ffffffff8150801f>] ret_from_fork+0x3f/0x70
      
      See also patch "block: destroy bdi before blockdev is unregistered"
      (commit ID 6cd18e71
      
      ).
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      bf2cf3ba
  12. 09 Nov, 2015 2 commits
  13. 05 Nov, 2015 1 commit
  14. 27 Oct, 2015 1 commit
  15. 28 Aug, 2015 1 commit
  16. 16 Jul, 2015 1 commit
  17. 04 Dec, 2014 1 commit
  18. 24 Nov, 2014 2 commits
  19. 12 Nov, 2014 1 commit
  20. 15 Sep, 2014 2 commits
    • Subhash Jadavani's avatar
      scsi: balance out autopm get/put calls in scsi_sysfs_add_sdev() · 6fe8c1db
      Subhash Jadavani authored
      
      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: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      6fe8c1db
    • Alan Stern's avatar
      scsi: don't store LUN bits in CDB[1] for USB mass-storage devices · 50c4e964
      Alan Stern authored
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarTiziano Bacocco <tiziano.bacocco@gmail.com>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      50c4e964
  21. 08 Aug, 2014 1 commit
  22. 25 Jul, 2014 4 commits
  23. 17 Jul, 2014 1 commit
  24. 27 Mar, 2014 1 commit
    • Hannes Reinecke's avatar
      [SCSI] Add EVPD page 0x83 and 0x80 to sysfs · b3ae8780
      Hannes Reinecke authored
      
      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: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      b3ae8780
  25. 19 Mar, 2014 1 commit
  26. 15 Mar, 2014 2 commits