1. 13 10月, 2007 3 次提交
    • M
      [SCSI] scsi_scan: Cope with kthread_run failing · a57b1fcc
      Matthew Wilcox 提交于
      If kthread_run failed, we would fail to scan the host, and leak the
      allocated async_scan_data.  Since using a separate thread is just an
      optimisation, do the scan synchronously if we fail to spawn a thread.
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      a57b1fcc
    • M
      [SCSI] Fix signness of parameters in scsi module · 10f4b89a
      Masatake YAMATO 提交于
      In scsi module I've found some inconsistency between variable type
      used in module_param_named and type passed to module_param_named as an
      argument. Especially the inconsistency of `max_scsi_luns' parameter is
      a bit serious because the description text says "last scsi LUN (should
      be between 1 and 2^32-1)".
      Signed-off-by: NMasatake YAMATO <jet@gyve.org>
      Acked-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      10f4b89a
    • M
      [SCSI] Fix async scanning double-add problems · 6b7f123f
      Matthew Wilcox 提交于
      Stress-testing and some thought has revealed some places where
      asynchronous scanning needs some more attention to locking.
      
       - Since async_scan is a bit, we need to hold the host_lock while
         modifying it to prevent races against other CPUs modifying the word
         that bit is in.  This is probably a theoretical race for the moment,
         but other patches may change that.
       - The async_scan bit means not only that this host is being scanned
         asynchronously, but that all the devices attached to this host are not
         yet added to sysfs.  So we must ensure that this bit is always in sync.
         I've chosen to do this with the scan_mutex since it's already acquired
         in most of the right places.
       - If the host changes state to deleted while we're in the middle of
         a scan, we'll end up with some devices on the host's list which must
         be deleted.  Add a check to scsi_sysfs_add_devices() to ensure the
         host is still running.
       - To avoid the async_scan bit being protected by three locks, the
         async_scan_lock now only protects the scanning_list.
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      6b7f123f
  2. 15 7月, 2007 1 次提交
  3. 20 6月, 2007 1 次提交
  4. 30 5月, 2007 1 次提交
    • H
      [SCSI] fix CONFIG_SCSI_WAIT_SCAN=m · f2f027c6
      Hugh Dickins 提交于
      CONFIG_MODULES=y
      CONFIG_SCSI=y
      CONFIG_SCSI_SCAN_ASYNC=y
      CONFIG_SCSI_WAIT_SCAN=m
      
      2.6.21-rc5-mm2 VFS panics unable to find my root on /dev/sda2, but boots
      okay if I change drivers/scsi/Kconfig to "default y" instead of "default m"
      for SCSI_WAIT_SCAN.
      
      Make sure there's a late_initcall to scsi_complete_async_scans when it's
      built in, so a monolithic SCSI_SCAN_ASYNC kernel can rely on the scans
      being completed before trying to mount root, even if they're slow.
      
      [akpm@linux-foundation.org: build fixes]
      Signed-off-by: NHugh Dickins <hugh@veritas.com>
      Acked-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      f2f027c6
  5. 21 3月, 2007 1 次提交
  6. 18 2月, 2007 1 次提交
  7. 17 2月, 2007 2 次提交
  8. 27 1月, 2007 1 次提交
  9. 14 1月, 2007 1 次提交
    • K
      [SCSI] scsi_scan message cosmetic error · 3424a65d
      Kurt Garloff 提交于
      Hi,
      
      Minor typo ...
      In my first iteration of patches (that got merged), the
      BLIST_ATTACH_PQ3 actually had the value 0x800000, but that
      got changed later to avoid conflicts. This piece must have
      been overlooked.
      You could obviously do something like %x and then add the
      bitflags, but that looks overkill for something that does
      not tend to change.
      
      Please merge.
      (Patch applied against latest 2.6.20rc version that I tested.)
      
      From: Kurt Garloff <kurt@garloff.de>
      Subject: [SCSI SCAN] Fix logging message for PQ3 devices
      
      The blacklist flags BLIST_ATTACH_PQ3 has value 0x1000000,
      not 0x800000.
      Signed-off-by: NKurt Garloff <garloff@suse.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      3424a65d
  10. 06 1月, 2007 1 次提交
    • J
      [SCSI] scsi_scan: fix report lun problems with CDROM or RBC devices · ddaf6fc8
      James Bottomley 提交于
      Apparently no ATAPI CD/DVD actually supports REPORT LUNS (in spite of
      claiming scsi-3 compliance, where it's mandatory) and worse, some
      crash or flake out on being sent the command.  This may actually be
      due to a conflict between SPC and MMC with MMC not listing REPORT LUNS
      as mandatory.  The same standards conflict exists for RBC as well.
      
      Fix all of this by reversing the blacklists for CDROM and RBC devices
      (i.e. now they have to have the BLIST_REPORTLUNS2 flag set even if the
      inquiry data returns scsi-3 compliance).
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      ddaf6fc8
  11. 04 1月, 2007 1 次提交
    • M
      [SCSI] Add missing completion to scsi_complete_async_scans() · 8bcc2412
      Matthew Wilcox 提交于
      If either scsi_complete_async_scans() is called a second time
      before the first call has finished, or a host scan is started while
      scsi_complete_async_scans() is still sleeping, it would fail to wake up
      the other task, which would sleep forever.
      
      I've changed the kernel-doc to make it clear that
      scsi_complete_async_scans() only guarantees that scans which started
      before it was called are guaranteed to have finished when it returns.
      I considered making it wait until all scans are completed, but it can't
      guarantee that no more scans will start before it returns anyway, and it
      runs the risk of confusing other callers of scsi_complete_async_scans()
      for hosts actually scanning.
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      8bcc2412
  12. 23 11月, 2006 3 次提交
  13. 22 11月, 2006 1 次提交
    • D
      WorkStruct: Pass the work_struct pointer instead of context data · 65f27f38
      David Howells 提交于
      Pass the work_struct pointer to the work function rather than context data.
      The work function can use container_of() to work out the data.
      
      For the cases where the container of the work_struct may go away the moment the
      pending bit is cleared, it is made possible to defer the release of the
      structure by deferring the clearing of the pending bit.
      
      To make this work, an extra flag is introduced into the management side of the
      work_struct.  This governs auto-release of the structure upon execution.
      
      Ordinarily, the work queue executor would release the work_struct for further
      scheduling or deallocation by clearing the pending bit prior to jumping to the
      work function.  This means that, unless the driver makes some guarantee itself
      that the work_struct won't go away, the work function may not access anything
      else in the work_struct or its container lest they be deallocated..  This is a
      problem if the auxiliary data is taken away (as done by the last patch).
      
      However, if the pending bit is *not* cleared before jumping to the work
      function, then the work function *may* access the work_struct and its container
      with no problems.  But then the work function must itself release the
      work_struct by calling work_release().
      
      In most cases, automatic release is fine, so this is the default.  Special
      initiators exist for the non-auto-release case (ending in _NAR).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      65f27f38
  14. 13 11月, 2006 1 次提交
  15. 12 10月, 2006 1 次提交
    • M
      [SCSI] Add ability to scan scsi busses asynchronously · 3e082a91
      Matthew Wilcox 提交于
      Since it often takes around 20-30 seconds to scan a scsi bus, it's
      highly advantageous to do this in parallel with other things.  The bulk
      of this patch is ensuring that devices don't change numbering, and that
      all devices are discovered prior to trying to start init.  For those
      who build SCSI as modules, there's a new scsi_wait_scan module that will
      ensure all bus scans are finished.
      
      This patch only handles drivers which call scsi_scan_host.  Fibre Channel,
      SAS, SATA, USB and Firewire all need additional work.
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      3e082a91
  16. 07 9月, 2006 1 次提交
  17. 03 9月, 2006 1 次提交
    • A
      [SCSI] SCSI: sanitize INQUIRY strings · e5b3cd42
      Alan Stern 提交于
      Sanitize the Vendor, Product, and Revision strings contained in an
      INQUIRY result by setting all non-graphic or non-ASCII characters to ' '.
      Since the standard disallows such characters, this will affect
      only non-compliant devices.
      
      To help maintain backward compatibility, NUL characters are treated
      specially.  They are taken as string terminators; they and all the
      following characters are set to ' '.  If some valid characters get
      erased as a result... well, we weren't seeing them before so we haven't
      lost anything.
      
      The primary purpose of this change is to allow blacklist entries to
      match devices with illegal Vendor or Product strings.
      
      In addition, the patch updates a couple of function prototypes, giving
      inq_result its correct type (unsigned char *).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      e5b3cd42
  18. 20 8月, 2006 1 次提交
    • D
      [SCSI] Don't add scsi_device for devices that return PQ=1, PDT=0x1f · 84961f28
      dave wysochanski 提交于
      Some targets may return slight variations of PQ and PDT to indicate
      no LUN mapped.  USB UFI setting PDT=0x1f but having reserved bits for
      PQ is one example, and NetApp targets returning PQ=1 and PDT=0x1f is
      another.  Both instances seem like reasonable responses according to
      SPC-3 and UFI specs.
      
      The current scsi_probe_and_add_lun() code adds a scsi_device
      for targets that return PQ=1 and PDT=0x1f.  This causes LUNs of type
      "UNKNOWN" to show up in /proc/scsi/scsi when no LUNs are mapped.
      In addition, subsequent rescans fail to recognize LUNs that may be
      added on the target, unless preceded by a write to the delete attribute
      of the "UNKNOWN" LUN.
      
      This patch addresses this problem by skipping over the scsi_add_lun()
      when PQ=1,PDT=0x1f is encountered, and just returns
      SCSI_SCAN_TARGET_PRESENT.
      Signed-off-by: NDave Wysochanski <davidw@netapp.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      84961f28
  19. 07 8月, 2006 2 次提交
  20. 01 7月, 2006 1 次提交
  21. 29 6月, 2006 1 次提交
    • B
      [SCSI] scsi: Device scanning oops for offlined devices (resend) · 309bd271
      Brian King 提交于
      If a device gets offlined as a result of the Inquiry sent
      during scanning, the following oops can occur. After the
      disk gets put into the SDEV_OFFLINE state, the error handler
      sends back the failed inquiry, which wakes the thread doing
      the scan. This starts a race between the scanning thread
      freeing the scsi device and the error handler calling
      scsi_run_host_queues to restart the host. Since the disk
      is in the SDEV_OFFLINE state, scsi_device_get will still
      work, which results in __scsi_iterate_devices getting
      a reference to the scsi disk when it shouldn't.
      
      The following execution thread causes the oops:
      
      CPU 0 (scan)				CPU 1 (eh)
      
      ---------------------------------------------------------
      scsi_probe_and_add_lun
                              ....
                                              scsi_eh_offline_sdevs
                                              scsi_eh_flush_done_q
      scsi_destroy_sdev
      scsi_device_dev_release
                                              scsi_restart_operations
                                               scsi_run_host_queues
                                                __scsi_iterate_devices
                                                 get_device
      scsi_device_dev_release_usercontext
                                                scsi_run_queue
                                                  <---OOPS--->
      
      The patch fixes this by changing the state of the sdev to SDEV_DEL
      before doing the final put_device, which should prevent the race
      from occurring.
      
      Original oops follows:
      
      Badness in kref_get at lib/kref.c:32
      Call Trace:
      [C00000002F4476D0] [C00000000000EE20] .show_stack+0x68/0x1b0 (unreliable)
      [C00000002F447770] [C00000000037515C] .program_check_exception+0x1cc/0x5a8
      [C00000002F447840] [C00000000000446C] program_check_common+0xec/0x100
       Exception: 700 at .kref_get+0x10/0x28
          LR = .kobject_get+0x20/0x3c
      [C00000002F447B30] [C00000002F447BC0] 0xc00000002f447bc0 (unreliable)
      [C00000002F447BB0] [C000000000254BDC] .get_device+0x20/0x3c
      [C00000002F447C30] [D000000000063188] .scsi_device_get+0x34/0xdc [scsi_mod]
      [C00000002F447CC0] [D0000000000633EC] .__scsi_iterate_devices+0x50/0xbc [scsi_mod]
      [C00000002F447D60] [D00000000006A910] .scsi_run_host_queues+0x34/0x5c [scsi_mod]
      [C00000002F447DF0] [D000000000069054] .scsi_error_handler+0xdb4/0xe44 [scsi_mod]
      [C00000002F447EE0] [C00000000007B4E0] .kthread+0x128/0x178
      [C00000002F447F90] [C000000000025E84] .kernel_thread+0x4c/0x68
      Unable to handle kernel paging request for <7>PCI: Enabling device: (0002:41:01.1), cmd 143
      data at address 0x000001b8
      Faulting instruction address: 0xd0000000000698e4
      sym1: <1010-66> rev 0x1 at pci 0002:41:01.1 irq 216
      sym1: No NVRAM, ID 7, Fast-80, LVD, parity checking
      sym1: SCSI BUS has been reset.
      scsi2 : sym-2.2.2
      cpu 0x0: Vector: 300 (Data Access) at [c00000002f447a30]
          pc: d0000000000698e4: .scsi_run_queue+0x2c/0x218 [scsi_mod]
          lr: d00000000006a904: .scsi_run_host_queues+0x28/0x5c [scsi_mod]
          sp: c00000002f447cb0
         msr: 9000000000009032
         dar: 1b8
       dsisr: 40000000
        current = 0xc0000000045fecd0
        paca    = 0xc00000000048ee80
          pid   = 1123, comm = scsi_eh_1
      enter ? for help
      [c00000002f447d60] d00000000006a904 .scsi_run_host_queues+0x28/0x5c [scsi_mod]
      [c00000002f447df0] d000000000069054 .scsi_error_handler+0xdb4/0xe44 [scsi_mod]
      [c00000002f447ee0] c00000000007b4e0 .kthread+0x128/0x178
      [c00000002f447f90] c000000000025e84 .kernel_thread+0x4c/0x68
      Signed-off-by: NBrian King <brking@us.ibm.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      309bd271
  22. 11 6月, 2006 1 次提交
  23. 29 5月, 2006 1 次提交
  24. 15 4月, 2006 4 次提交
    • A
      [SCSI] scsi_scan.c: fix compile warnings · c5f2e640
      akpm@osdl.org 提交于
      drivers/scsi/scsi_scan.c: In function `scsi_probe_and_add_lun':
      drivers/scsi/scsi_scan.c:926: warning: unused variable `vend'
      drivers/scsi/scsi_scan.c:926: warning: unused variable `mod'
      drivers/scsi/scsi_scan.c: At top level:
      drivers/scsi/scsi_scan.c:829: warning: `scsi_inq_str' defined but not used
      
      Fix those, tighten up the (somewhat poorly-designed) logging macro and fix
      some coding-style warts.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      c5f2e640
    • K
      [SCSI] BLIST_ATTACH_PQ3 flags · 13f7e5ac
      Kurt Garloff 提交于
      Some devices report a peripheral qualifier of 3 for LUN 0; with the original
      code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
      have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
      Also, the device at LUN 0 (which is not connected according to the PQ) is not
      registered with the OS.
      
      Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
      report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
      most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
      reference for an infamous example.
      
      This is patch 3/3:
      3. Implement the blacklist flag BLIST_ATTACH_PQ3 that makes the scsi
         scanning code register PQ3 devices and continues scanning; only sg
         will attach thanks to scsi_bus_match().
      Signed-off-by: NKurt Garloff <garloff@suse.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      13f7e5ac
    • K
      [SCSI] Better log messages for PQ3 devs · 6c7154c9
      Kurt Garloff 提交于
      Some devices report a peripheral qualifier of 3 for LUN 0; with the original
      code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
      have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
      Also, the device at LUN 0 (which is not connected according to the PQ) is not
      registered with the OS.
      
      Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
      report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
      most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
      reference for an infamous example.
      
      This patch 2/3:
      If a PQ3 device is found, log a message that describes the device
      (INQUIRY DATA and C:B:T:U tuple) and make a suggestion for blacklisting
      it.
      Signed-off-by: NKurt Garloff <garloff@suse.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      6c7154c9
    • K
      [SCSI] Try LUN 1 and use bflags · 4186ab19
      Kurt Garloff 提交于
      Some devices report a peripheral qualifier of 3 for LUN 0; with the original
      code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
      have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
      Also, the device at LUN 0 (which is not connected according to the PQ) is not
      registered with the OS.
      
      Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
      report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
      most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
      reference for an infamous example.
      
      This is patch 1/3:
      If we end up in sequential scan, at least try LUN 1 for devices
      that reported a PQ of 3 for LUN 0.
      Also return blacklist flags, even for PQ3 devices.
      Signed-off-by: NKurt Garloff <garloff@suse.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      4186ab19
  25. 13 4月, 2006 1 次提交
  26. 15 3月, 2006 1 次提交
  27. 12 3月, 2006 1 次提交
  28. 28 2月, 2006 4 次提交