1. 26 Sep, 2016 1 commit
    • Bart Van Assche's avatar
      scsi: Avoid that toggling use_blk_mq triggers a memory leak · 8d58881b
      Bart Van Assche authored
      This patch avoids that the following memory leak is triggered if
      use_blk_mq is disabled after a SCSI host has been allocated by the
      ib_srp driver and before the same SCSI host is freed:
      
      unreferenced object 0xffff8803a168c568 (size 256):
        backtrace:
          [<ffffffff81620c95>] kmemleak_alloc+0x45/0xa0
          [<ffffffff811bb104>] __kmalloc_node+0x1e4/0x400
          [<ffffffff81309fe4>] blk_mq_alloc_tag_set+0xb4/0x230
          [<ffffffff814731b7>] scsi_mq_setup_tags+0xc7/0xd0
          [<ffffffff81469c26>] scsi_add_host_with_dma+0x216/0x2d0
          [<ffffffffa064bef5>] srp_create_target+0xe55/0x13d0 [ib_srp]
          [<ffffffff8143ce23>] dev_attr_store+0x13/0x20
          [<ffffffff8125f030>] sysfs_kf_write+0x40/0x50
          [<ffffffff8125e397>] kernfs_fop_write+0x137/0x1c0
          [<ffffffff811d8c13>] __vfs_write+0x23/0x140
          [<ffffffff811d92e0>] vfs_write+0xb0/0x190
          [<ffffffff811da5b4>] SyS_write+0x44/0xa0
          [<ffffffff8162c8a5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      
      Fixes: 9aa9cc42 ("scsi: remove the disable_blk_mq host flag")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      8d58881b
  2. 15 Jul, 2016 1 commit
  3. 15 Apr, 2016 1 commit
  4. 19 Nov, 2015 1 commit
  5. 09 Nov, 2015 1 commit
  6. 23 Jan, 2015 1 commit
    • Shaohua Li's avatar
      block: support different tag allocation policy · ee1b6f7a
      Shaohua Li authored
      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: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      ee1b6f7a
  7. 04 Dec, 2014 1 commit
  8. 24 Nov, 2014 2 commits
  9. 12 Nov, 2014 4 commits
  10. 29 Oct, 2014 1 commit
  11. 30 Sep, 2014 1 commit
  12. 15 Sep, 2014 2 commits
    • 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
    • Kashyap.Desai@avagotech.com's avatar
      scsi: add use_cmd_list flag · 64bdcbc4
      Kashyap.Desai@avagotech.com authored
      Add a use_cmd_list flag in struct Scsi_Host to request keeping track of
      all outstanding commands per device.
      
      Default behaviour is not to keep track of cmd_list per sdev, as this may
      introduce lock contention. (overhead is more on multi-node NUMA.), and
      only enable it on the two drivers that need it.
      Signed-off-by: default avatarKashyap Desai <kashyap.desai@avagotech.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      64bdcbc4
  13. 25 Jul, 2014 3 commits
  14. 17 Jul, 2014 4 commits
  15. 27 Mar, 2014 1 commit
  16. 19 Dec, 2013 1 commit
    • Hannes Reinecke's avatar
      [SCSI] improved eh timeout handler · e494f6a7
      Hannes Reinecke authored
      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: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      e494f6a7
  17. 28 Nov, 2013 1 commit
    • Martin K. Petersen's avatar
      [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers · 54b2b50c
      Martin K. Petersen authored
      Some host adapters do not pass commands through to the target disk
      directly. Instead they provide an emulated target which may or may not
      accurately report its capabilities. In some cases the physical device
      characteristics are reported even when the host adapter is processing
      commands on the device's behalf. This can lead to adapter firmware hangs
      or excessive I/O errors.
      
      This patch disables WRITE SAME for devices connected to host adapters
      that provide an emulated target. Driver writers can disable WRITE SAME
      by setting the no_write_same flag in the host adapter template.
      
      [jejb: fix up rejections due to eh_deadline patch]
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      54b2b50c
  18. 25 Oct, 2013 2 commits
  19. 09 Apr, 2013 2 commits
    • Al Viro's avatar
      scsi: bury ->proc_info() · 70ef457d
      Al Viro authored
      all users converted to ->show_info()/->write_info()
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      70ef457d
    • Al Viro's avatar
      scsi: saner replacements for ->proc_info() · 0ffddfbb
      Al Viro authored
      It's still an obsolete interface; don't introduce those in new drivers.
      However, it's saner than the ->proc_info() and commits after this one
      will convert the existing ->proc_info() users to it.
      
      The read side is ->show_info(seq_file *, struct Scsi_Host *); use
      seq_... for generating contents.
      
      The write side is ->write_info(struct Scsi_Host *, char *, int).
      
      Again, this is driven by procfs needs; we are going to kill ->write_proc()
      and ->read_proc() and this is the main obstacle to burying that piece of
      shit.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      0ffddfbb
  20. 24 Feb, 2013 1 commit
  21. 24 Sep, 2012 1 commit
  22. 08 Jan, 2012 1 commit
  23. 29 Aug, 2011 1 commit
    • Mike Christie's avatar
      [SCSI] scsi scan: don't fail scans when host is in recovery · 76e4e12f
      Mike Christie authored
      The problem is that if we are doing a scsi scan then the device goes
      into recovery then we will wait for the recovery to complete. It waits
      because scsi-ml will send inquiries or report luns and the queueing code
      will have been blocked due to the host not being ready. However, if we
      are in recovery and then a scan is started the scan will silently fail
      and some devices will not be added.
      
      It is easy to hit the problem where devices do not show up with
      FC where we are doing tests that disrupt the target controllers.
      When the controller is disruprted (reboot, or setting firmware, etc),
      and we cause the dev loss tmo to fire then devices will be removed
      Then when the problem has been fixed, the rport will be scanned and
      devices should be added back. But if we cause another disruption before
      scanning has started then devices will not get added back. If the problem
      is not started until the scan is started then the devices will be added
      back.
      
      This patch fixes that problem by not failing scans when the host
      is in recovery. We will let scsi-ml send the IO and let the queueing
      and scsi error handling deal with it like is done if we went into
      recovery while scanning.
      
      For recovery cases where the host is being torn down then with the
      patch we will still fail the scan since there is not point in scanning.
      Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      76e4e12f
  24. 27 Aug, 2011 1 commit
  25. 31 Mar, 2011 1 commit
  26. 16 Nov, 2010 1 commit
    • Jeff Garzik's avatar
      SCSI host lock push-down · f281233d
      Jeff Garzik authored
      Move the mid-layer's ->queuecommand() invocation from being locked
      with the host lock to being unlocked to facilitate speeding up the
      critical path for drivers who don't need this lock taken anyway.
      
      The patch below presents a simple SCSI host lock push-down as an
      equivalent transformation.  No locking or other behavior should change
      with this patch.  All existing bugs and locking orders are preserved.
      
      Additionally, add one parameter to queuecommand,
      	struct Scsi_Host *
      and remove one parameter from queuecommand,
      	void (*done)(struct scsi_cmnd *)
      
      Scsi_Host* is a convenient pointer that most host drivers need anyway,
      and 'done' is redundant to struct scsi_cmnd->scsi_done.
      
      Minimal code disturbance was attempted with this change.  Most drivers
      needed only two one-line modifications for their host lock push-down.
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      Acked-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  27. 10 Sep, 2010 1 commit
  28. 02 Jun, 2010 1 commit