ata fixes for 7.0-rc3

- Fix a problem where the deferred non-NCQ command would incorrectly get
    completed as a failed command, if there was another command that timed
    out. Found by Gemini. (Guenter)
 
  - The deferred non-NCQ command work is only supposed to run after the
    last NCQ command finishes. However, because the work was never canceled
    on error (e.g. a timeout), the work could incorrectly run when commands
    were still in flight. Found by syzbot. (me)
 
  - Add a quirk to make sure that QEMU harddrives can potentially use up to
    32 MiB I/Os. (Pedro)
 
  - Add a quirk to disable LPM on Seagate ST1000DM010-2EP102. (Maximilian)
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRN+ES/c4tHlMch3DzJZDGjmcZNcgUCaarKRAAKCRDJZDGjmcZN
 cvqoAQCU9tcNQZcVRtR+QpWmk9ZDqPFpI0qde9TWxVxByx1lUQEAubgAkf0F0Dp3
 4eBP43Tniv/7SlPCKjbhEWEq6rvX7gA=
 =YBsd
 -----END PGP SIGNATURE-----

Merge tag 'ata-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux

Pull ata fixes from Niklas Cassel:

 - Fix a problem where the deferred non-NCQ command would incorrectly
   get completed as a failed command, if there was another command that
   timed out. Found by Gemini (Guenter)

 - The deferred non-NCQ command work is only supposed to run after the
   last NCQ command finishes. However, because the work was never
   canceled on error (e.g. a timeout), the work could incorrectly run
   when commands were still in flight. Found by syzbot (me)

 - Add a quirk to make sure that QEMU harddrives can potentially use up
   to 32 MiB I/Os (Pedro)

 - Add a quirk to disable LPM on Seagate ST1000DM010-2EP102 (Maximilian)

* tag 'ata-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
  ata: libata-eh: Fix detection of deferred qc timeouts
  ata: libata-core: Add BRIDGE_OK quirk for QEMU drives
  ata: libata: cancel pending work after clearing deferred_qc
  ata: libata-core: Disable LPM on ST1000DM010-2EP102
This commit is contained in:
Linus Torvalds 2026-03-06 08:41:20 -08:00
commit 723b5c93aa
3 changed files with 5 additions and 1 deletions

View file

@ -4189,6 +4189,7 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
ATA_QUIRK_FIRMWARE_WARN },
/* Seagate disks with LPM issues */
{ "ST1000DM010-2EP102", NULL, ATA_QUIRK_NOLPM },
{ "ST2000DM008-2FR102", NULL, ATA_QUIRK_NOLPM },
/* drives which fail FPDMA_AA activation (some may freeze afterwards)
@ -4231,6 +4232,7 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
/* Devices that do not need bridging limits applied */
{ "MTRON MSP-SATA*", NULL, ATA_QUIRK_BRIDGE_OK },
{ "BUFFALO HD-QSU2/R5", NULL, ATA_QUIRK_BRIDGE_OK },
{ "QEMU HARDDISK", "2.5+", ATA_QUIRK_BRIDGE_OK },
/* Devices which aren't very happy with higher link speeds */
{ "WD My Book", NULL, ATA_QUIRK_1_5_GBPS },

View file

@ -647,7 +647,7 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
break;
}
if (qc == ap->deferred_qc) {
if (i < ATA_MAX_QUEUE && qc == ap->deferred_qc) {
/*
* This is a deferred command that timed out while
* waiting for the command queue to drain. Since the qc
@ -659,6 +659,7 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
*/
WARN_ON_ONCE(qc->flags & ATA_QCFLAG_ACTIVE);
ap->deferred_qc = NULL;
cancel_work(&ap->deferred_qc_work);
set_host_byte(scmd, DID_TIME_OUT);
scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
} else if (i < ATA_MAX_QUEUE) {

View file

@ -1699,6 +1699,7 @@ void ata_scsi_requeue_deferred_qc(struct ata_port *ap)
scmd = qc->scsicmd;
ap->deferred_qc = NULL;
cancel_work(&ap->deferred_qc_work);
ata_qc_free(qc);
scmd->result = (DID_SOFT_ERROR << 16);
scsi_done(scmd);