[PATCH v1] ata: libata-eh: Add timeout table entry for STANDBY IMMEDIATE

Xingui Yang <[email protected]>
Newsgroups org.kernel.vger.linux-ide,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
ATA_CMD_STANDBYNOW1 is not in the ata_eh_cmd_timeout_table and falls
back to the 5s default (ATA_EH_CMD_DFL_TIMEOUT), which is too short
for some drives to complete a STANDBY IMMEDIATE command issued from
ata_dev_power_set_standby() via ata_exec_internal():

  ata1.00: qc timeout after 5000 msecs (cmd 0xe0)
  ata1.00: STANDBY IMMEDIATE failed (err_mask=0x4)

Reuse the existing ata_eh_flush_timeouts for this command, as a drive
entering standby may need to flush its internal cache, making the flush
timeout a natural fit.

Signed-off-by: Xingui Yang <[email protected]>
---
 drivers/ata/libata-eh.c | 2 ++
 include/linux/libata.h  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 05df7ea6954a..8f9e12f460c3 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -149,6 +149,8 @@ ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = {
 	  .timeouts = ata_eh_flush_timeouts },
 	{ .commands = CMDS(ATA_CMD_VERIFY),
 	  .timeouts = ata_eh_reset_timeouts },
+	{ .commands = CMDS(ATA_CMD_STANDBYNOW1),
+	  .timeouts = ata_eh_flush_timeouts },
 };
 #undef CMDS
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 96e626d6a7ca..6c0d385b2cde 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -425,7 +425,7 @@ enum {
 	/* This should match the actual table size of
 	 * ata_eh_cmd_timeout_table in libata-eh.c.
 	 */
-	ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 8,
+	ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 9,
 
 	/* User visible DMA mask for DMA control. DO NOT renumber. */
 	ATA_DMA_MASK_ATA	= (1 << 0),	/* DMA on ATA Disk */
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.