1. 28 1月, 2017 2 次提交
  2. 09 11月, 2016 1 次提交
  3. 27 9月, 2016 1 次提交
    • B
      scsi: Avoid that toggling use_blk_mq triggers a memory leak · 8d58881b
      Bart Van Assche 提交于
      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: NBart 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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      8d58881b
  4. 16 7月, 2016 1 次提交
  5. 16 4月, 2016 1 次提交
  6. 20 11月, 2015 1 次提交
  7. 10 11月, 2015 1 次提交
  8. 24 1月, 2015 1 次提交
    • S
      block: support different tag allocation policy · ee1b6f7a
      Shaohua Li 提交于
      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: NShaohua Li <shli@fb.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      ee1b6f7a
  9. 04 12月, 2014 1 次提交
  10. 24 11月, 2014 2 次提交
  11. 12 11月, 2014 4 次提交
  12. 29 10月, 2014 1 次提交
  13. 30 9月, 2014 1 次提交
  14. 16 9月, 2014 2 次提交
    • 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
    • K
      scsi: add use_cmd_list flag · 64bdcbc4
      Kashyap.Desai@avagotech.com 提交于
      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: NKashyap Desai <kashyap.desai@avagotech.com>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      64bdcbc4
  15. 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
  16. 25 7月, 2014 1 次提交
  17. 18 7月, 2014 4 次提交
  18. 27 3月, 2014 1 次提交
  19. 19 12月, 2013 1 次提交
    • 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
  20. 29 11月, 2013 1 次提交
    • M
      [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers · 54b2b50c
      Martin K. Petersen 提交于
      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: NMartin K. Petersen <martin.petersen@oracle.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      54b2b50c
  21. 25 10月, 2013 2 次提交
  22. 10 4月, 2013 2 次提交
    • A
      scsi: bury ->proc_info() · 70ef457d
      Al Viro 提交于
      all users converted to ->show_info()/->write_info()
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      70ef457d
    • A
      scsi: saner replacements for ->proc_info() · 0ffddfbb
      Al Viro 提交于
      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: NAl Viro <viro@zeniv.linux.org.uk>
      0ffddfbb
  23. 24 2月, 2013 1 次提交
  24. 24 9月, 2012 1 次提交
  25. 09 1月, 2012 1 次提交
  26. 29 8月, 2011 1 次提交
    • M
      [SCSI] scsi scan: don't fail scans when host is in recovery · 76e4e12f
      Mike Christie 提交于
      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: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      76e4e12f
  27. 27 8月, 2011 1 次提交
  28. 31 3月, 2011 1 次提交