1. 27 10月, 2015 1 次提交
  2. 13 10月, 2015 1 次提交
  3. 05 10月, 2015 1 次提交
  4. 01 10月, 2015 1 次提交
    • M
      ata: ahci: find eSATA ports and flag them as removable · 8a3e33cf
      Manuel Lauss 提交于
      If the AHCI ports' HPCP or ESP bits are set, the port
      should be considered external (e.g. eSATA) and is marked
      as removable.  Userspace tools like udisks then treat it
      like an usb drive.
      
      With this patch applied, when I plug a drive into the esata port,
      KDE pops up a window asking what to do with the drives(s), just
      like it does for any random USB stick.
      
      Removability is indicated to the upper layers by way of the
      SCSI RMB bit, as I haven't found another way to signal
      userspace to treat a sata disk like any usb stick.
      Signed-off-by: NManuel Lauss <manuel.lauss@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      8a3e33cf
  5. 04 8月, 2015 1 次提交
    • T
      Revert "libata: Implement NCQ autosense" · 74a80d67
      Tejun Heo 提交于
      This reverts commit 42b966fb.
      
      As implemented, ACS-4 sense reporting for ATA devices bypasses error
      diagnosis and handling in libata degrading EH behavior significantly.
      Revert the related changes for now.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: stable@vger.kernel.org #v4.1+
      74a80d67
  6. 03 8月, 2015 1 次提交
  7. 15 7月, 2015 1 次提交
  8. 27 3月, 2015 5 次提交
  9. 25 3月, 2015 1 次提交
    • T
      libata: remove ATA_FLAG_LOWTAG · 3a028243
      Tejun Heo 提交于
      sata_sil24 for some reason pukes when tags are allocated round-robin
      which helps tag ordered controllers.  To work around the issue,
      72dd299d ("libata: allow sata_sil24 to opt-out of tag ordered
      submission") introduced ATA_FLAG_LOWTAG which tells libata tag
      allocation to do lowest-first.
      
      However, with the recent switch to blk-mq tag allocation, the liata
      tag allocation code path is no longer used and the workaround is now
      implemented in the block layer and selected by setting
      scsi_host_template->tag_alloc_policy to BLK_TAG_ALLOC_FIFO.  See
      9269e234 ("libata: make sata_sil24 use fifo tag allocator").
      
      This leaves ATA_FLAG_LOWTAG withoout any actual user.  Remove it.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Shaohua Li <shli@fb.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      3a028243
  10. 25 1月, 2015 1 次提交
  11. 24 1月, 2015 1 次提交
    • S
      libata: use blk taging · 12cb5ce1
      Shaohua Li 提交于
      libata uses its own tag management which is duplication and the
      implementation is poor. And if we switch to blk-mq, tag is build-in.
      It's time to switch to generic taging.
      
      The SAS driver has its own tag management, and looks we can't directly
      map the host controler tag to SATA tag. So I just bypassed the SAS case.
      
      I changed the code/variable name for the tag management of libata to
      make it self contained. Only sas will use it. Later if libsas implements
      its tag management, the tag management code in libata can be deleted
      easily.
      
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NShaohua Li <shli@fb.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      12cb5ce1
  12. 08 1月, 2015 1 次提交
    • M
      libata: Whitelist SSDs that are known to properly return zeroes after TRIM · e61f7d1c
      Martin K. Petersen 提交于
      As defined, the DRAT (Deterministic Read After Trim) and RZAT (Return
      Zero After Trim) flags in the ATA Command Set are unreliable in the
      sense that they only define what happens if the device successfully
      executed the DSM TRIM command. TRIM is only advisory, however, and the
      device is free to silently ignore all or parts of the request.
      
      In practice this renders the DRAT and RZAT flags completely useless and
      because the results are unpredictable we decided to disable discard in
      MD for 3.18 to avoid the risk of data corruption.
      
      Hardware vendors in the real world obviously need better guarantees than
      what the standards bodies provide. Unfortuntely those guarantees are
      encoded in product requirements documents rather than somewhere we can
      key off of them programatically. So we are compelled to disabling
      discard_zeroes_data for all devices unless we explicitly have data to
      support whitelisting them.
      
      This patch whitelists SSDs from a few of the main vendors. None of the
      whitelists are based on written guarantees. They are purely based on
      empirical evidence collected from internal and external users that have
      tested or qualified these drives in RAID deployments.
      
      The whitelist is only meant as a starting point and is by no means
      comprehensive:
      
         - All intel SSD models except for 510
         - Micron M5?0/M600
         - Samsung SSDs
         - Seagate SSDs
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      e61f7d1c
  13. 26 12月, 2014 1 次提交
  14. 05 12月, 2014 1 次提交
  15. 25 11月, 2014 1 次提交
  16. 24 11月, 2014 1 次提交
  17. 12 11月, 2014 1 次提交
    • C
      scsi: don't set tagging state from scsi_adjust_queue_depth · c8b09f6f
      Christoph Hellwig 提交于
      Remove the tagged argument from scsi_adjust_queue_depth, and just let it
      handle the queue depth.  For most drivers those two are fairly separate,
      given that most modern drivers don't care about the SCSI "tagged" status
      of a command at all, and many old drivers allow queuing of multiple
      untagged commands in the driver.
      
      Instead we start out with the ->simple_tags flag set before calling
      ->slave_configure, which is how all drivers actually looking at
      ->simple_tags except for one worke anyway.  The one other case looks
      broken, but I've kept the behavior as-is for now.
      
      Except for that we only change ->simple_tags from the ->change_queue_type,
      and when rejecting a tag message in a single driver, so keeping this
      churn out of scsi_adjust_queue_depth is a clear win.
      
      Now that the usage of scsi_adjust_queue_depth is more obvious we can
      also remove all the trivial instances in ->slave_alloc or ->slave_configure
      that just set it to the cmd_per_lun default.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMike Christie <michaelc@cs.wisc.edu>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c8b09f6f
  18. 06 11月, 2014 2 次提交
  19. 18 7月, 2014 1 次提交
  20. 02 5月, 2014 1 次提交
  21. 16 1月, 2014 1 次提交
    • T
      libata: disable LPM for some WD SATA-I devices · ecd75ad5
      Tejun Heo 提交于
      For some reason, some early WD drives spin up and down drives
      erratically when the link is put into slumber mode which can reduce
      the life expectancy of the device significantly.  Unfortunately, we
      don't have full list of devices and given the nature of the issue it'd
      be better to err on the side of false positives than the other way
      around.  Let's disable LPM on all WD devices which match one of the
      known problematic model prefixes and are SATA-I.
      
      As horkage list doesn't support matching SATA capabilities, this is
      implemented as two horkages - WD_BROKEN_LPM and NOLPM.  The former is
      set for the known prefixes and sets the latter if the matched device
      is SATA-I.
      
      Note that this isn't optimal as this disables all LPM operations and
      partial link power state reportedly works fine on these; however, the
      way LPM is implemented in libata makes it difficult to precisely map
      libata LPM setting to specific link power state.  Well, these devices
      are already fairly outdated.  Let's just disable whole LPM for now.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-and-tested-by: NNikos Barkas <levelwol@gmail.com>
      Reported-and-tested-by: NIoannis Barkas <risc4all@yahoo.com>
      References: https://bugzilla.kernel.org/show_bug.cgi?id=57211
      Cc: stable@vger.kernel.org
      ecd75ad5
  22. 20 12月, 2013 1 次提交
    • T
      libata, freezer: avoid block device removal while system is frozen · 85fbd722
      Tejun Heo 提交于
      Freezable kthreads and workqueues are fundamentally problematic in
      that they effectively introduce a big kernel lock widely used in the
      kernel and have already been the culprit of several deadlock
      scenarios.  This is the latest occurrence.
      
      During resume, libata rescans all the ports and revalidates all
      pre-existing devices.  If it determines that a device has gone
      missing, the device is removed from the system which involves
      invalidating block device and flushing bdi while holding driver core
      layer locks.  Unfortunately, this can race with the rest of device
      resume.  Because freezable kthreads and workqueues are thawed after
      device resume is complete and block device removal depends on
      freezable workqueues and kthreads (e.g. bdi_wq, jbd2) to make
      progress, this can lead to deadlock - block device removal can't
      proceed because kthreads are frozen and kthreads can't be thawed
      because device resume is blocked behind block device removal.
      
      839a8e86 ("writeback: replace custom worker pool implementation
      with unbound workqueue") made this particular deadlock scenario more
      visible but the underlying problem has always been there - the
      original forker task and jbd2 are freezable too.  In fact, this is
      highly likely just one of many possible deadlock scenarios given that
      freezer behaves as a big kernel lock and we don't have any debug
      mechanism around it.
      
      I believe the right thing to do is getting rid of freezable kthreads
      and workqueues.  This is something fundamentally broken.  For now,
      implement a funny workaround in libata - just avoid doing block device
      hot[un]plug while the system is frozen.  Kernel engineering at its
      finest.  :(
      
      v2: Add EXPORT_SYMBOL_GPL(pm_freezing) for cases where libata is built
          as a module.
      
      v3: Comment updated and polling interval changed to 10ms as suggested
          by Rafael.
      
      v4: Add #ifdef CONFIG_FREEZER around the hack as pm_freezing is not
          defined when FREEZER is not configured thus breaking build.
          Reported by kbuild test robot.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NTomaž Šolc <tomaz.solc@tablix.org>
      Reviewed-by: N"Rafael J. Wysocki" <rjw@rjwysocki.net>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=62801
      Link: http://lkml.kernel.org/r/20131213174932.GA27070@htj.dyndns.org
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: stable@vger.kernel.org
      Cc: kbuild test robot <fengguang.wu@intel.com>
      85fbd722
  23. 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
  24. 17 10月, 2013 1 次提交
    • A
      ATA / ACPI: remove power dependent device handling · b08fc109
      Aaron Lu 提交于
      Previously, we wanted SCSI devices corrsponding to ATA devices to
      be runtime resumed when the power resource for those ATA device was
      turned on by some other device, so we added the SCSI device to the
      dependent device list of the ATA device's ACPI node.  However, this
      code has no effect after commit 41863fce (ACPI / power: Drop automaitc
      resume of power resource dependent devices) and the mechanism it was
      supposed to implement is regarded as a bad idea now, so drop it.
      
      [rjw: Changelog]
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b08fc109
  25. 25 8月, 2013 1 次提交
  26. 24 8月, 2013 1 次提交
    • A
      ata: acpi: rework the ata acpi bind support · f1bc1e4c
      Aaron Lu 提交于
      Binding ACPI handle to SCSI device has several drawbacks, namely:
      1 During ATA device initialization time, ACPI handle will be needed
        while SCSI devices are not created yet. So each time ACPI handle is
        needed, instead of retrieving the handle by ACPI_HANDLE macro,
        a namespace scan is performed to find the handle for the corresponding
        ATA device. This is inefficient, and also expose a restriction on
        calling path not holding any lock.
      2 The binding to SCSI device tree makes code complex, while at the same
        time doesn't bring us any benefit. All ACPI handlings are still done
        in ATA module, not in SCSI.
      
      Rework the ATA ACPI binding code to bind ACPI handle to ATA transport
      devices(ATA port and ATA device). The binding needs to be done only once,
      since the ATA transport devices do not go away with hotplug. And due to
      this, the flush_work call in hotplug handler for ATA bay is no longer
      needed.
      
      Tested on an Intel test platform for binding and runtime power off for
      ODD(ZPODD) and hard disk; on an ASUS S400C for binding and normal boot
      and S3, where its SATA port node has _SDD and _GTF control methods when
      configured as an AHCI controller and its PATA device node has _GTF
      control method when configured as an IDE controller. SATA PMP binding
      and ATA hotplug is not tested.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Tested-by: NDirk Griesbach <spamthis@freenet.de>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      f1bc1e4c
  27. 23 7月, 2013 1 次提交
  28. 19 6月, 2013 1 次提交
    • G
      libata: cleanup SAT error translation · 78062c50
      Gwendal Grignou 提交于
      - Remove duplicate Medium Error Entry.
      
      - Fix translations to match SAT2 translation table.
      
      - Remove warning messages when translation is not found when decoding
        error or status register.
      
      - Goes through status register decoding when only ABRT bit is set in
        error register.
      
      Tested: When a disk fails, it sets
      
        Status = 0x71 [DRDY DF ERR] , Error = 0x4 [ABRT]
      
      This patch will make the sense key HARDWARE_ERROR instead.
      
      When there is a simple command syntax error:
      
        Status = 0x51 [DRDY ERR] , Error = 0x4 [ABRT]
      
      The sense key remains ABORTED_COMMAND.
      
      tj: Some updates to the description and comments.
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      78062c50
  29. 15 5月, 2013 1 次提交
  30. 12 4月, 2013 1 次提交
  31. 04 4月, 2013 2 次提交
    • A
      libata-acpi: remove redundent code for power resource handling · 7381fe73
      Aaron Lu 提交于
      With commit:
      bc9b6407
      ACPI / PM: Rework the handling of devices depending on power resources
      
      The ACPI core now takes care of the power resources an acpi device
      depends on in that when the power resources are turned on, any devices
      that are bound to or in the dependent list of this acpi device will be
      runtime resumed. So there is no need for ata acpi code to duplicate this
      effort, and thus, the ata_acpi_(un)register_power_resource functions are
      no longer needed.
      
      The above commit thinks the scsi device is not bound to the acpi device,
      so needs to be added to the dependent list. But actually, it is. So
      there is no need to add it to the dependent list, or it will be runtime
      resumed twice(though this wouldn't cause any problem).
      
      This patch fixes it, and as a result, the
      ata_acpi_(un)register_power_resource and ata_acpi_(un)bind functions
      are removed.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      7381fe73
    • K
      [libata] Fix HDIO_DRIVE_* ioctl() Linux 3.9 regression · 6d3bfc7b
      Krzysztof Mazur 提交于
      On Mon, Mar 25, 2013 at 06:26:50PM +0100, Ronald wrote:
      > In reply to [1]: I have the same issue. Git bisect took 50+ rebuilds xD
      >
      > Smartd does not work anymore since 84a9a8cd ([libata] Set proper SK
      > when CK_COND is set.).
      
      > [1] http://www.spinics.net/lists/linux-ide/msg45268.html
      
      It seems that the SAM_STAT_CHECK_CONDITION is not cleared
      causing -EIO, because that patch modified sensebuf and
      the check for clearing SAM_STAT_CHECK_CONDITION is no longer valid.
      
      Fix that.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6d3bfc7b
  32. 21 2月, 2013 1 次提交
    • G
      [libata] Set proper SK when CK_COND is set. · 84a9a8cd
      Gwendal Grignou 提交于
      When the user application sends a ATA_12 or ATA_16 PASSTHROUGH
      scsi command, put the task file register in the sense data with the
      proper Sense Key. Instead of NO SENSE, set RECOVERED, as
      specified in [SAT2]12.2.5 Table 92.
      
      Tested:
      Using udev ata_id to generate a passthrough command, IDENTIFY:
      before:
       sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
      a1 08 2e 00 01 00 00 00 00 ec 00 00
       sd 0:0:0:0: [sda] Sense Key : No Sense [current] [descriptor]
       Descriptor sense data with sense descriptors (in hex):
               72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 3f
               00 18 00 a6 e0 50
      
      after
       sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
      a1 08 2e 00 01 00 00 00 00 ec 00 00
       sd 0:0:0:0: [sda]  Sense Key : Recovered Error [current] [descriptor]
       Descriptor sense data with sense descriptors (in hex):
              72 01 00 1d 00 00 00 0e 09 0c 00 00 00 01 00 00
              00 00 00 00 00 50
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      84a9a8cd
  33. 22 1月, 2013 1 次提交
    • A
      libata: identify and init ZPODD devices · afe75951
      Aaron Lu 提交于
      The ODD can be enabled for ZPODD if the following three conditions are
      satisfied:
      1 The ODD supports device attention;
      2 The platform can runtime power off the ODD through ACPI;
      3 The ODD is either slot type or drawer type.
      For such ODDs, zpodd_init is called and a new structure is allocated for
      it to store ZPODD related stuffs.
      
      And the zpodd_dev_enabled function is used to test if ZPODD is currently
      enabled for this ODD.
      
      A new config CONFIG_SATA_ZPODD is added to selectively build ZPODD code.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      afe75951
  34. 14 12月, 2012 1 次提交
    • X
      [libata] fix Null pointer dereference on disk error · 26cd4d65
      Xiaotian Feng 提交于
      Following oops were observed when disk error happened:
      
      [ 4272.896937] sd 0:0:0:0: [sda] Unhandled error code
      [ 4272.896939] sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
      [ 4272.896942] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 5a de a7 00 00 08 00
      [ 4272.896951] end_request: I/O error, dev sda, sector 5955239
      [ 4291.574947] BUG: unable to handle kernel NULL pointer dereference at (null)
      [ 4291.658305] IP: [] ahci_activity_show+0x1/0x40
      [ 4291.730090] PGD 76dbbc067 PUD 6c4fba067 PMD 0
      [ 4291.783408] Oops: 0000 [#1] SMP
      [ 4291.822100] last sysfs file: /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity
      [ 4291.934235] CPU 9
      [ 4291.958301] Pid: 27942, comm: hwinfo ......
      
      ata_scsi_find_dev could return NULL, so ata_scsi_activity_{show,store} should check if atadev is NULL.
      Signed-off-by: NXiaotian Feng <dannyfeng@tencent.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      26cd4d65