Skip to contentSkip to conversation

ata: libata-core: relax checks in ata_read_log_directory()

PATCH Applied Damien Le Moal 2 participants 3 messages Oct 9, 2025 – Oct 13, 2025 libata

lore
Share & tools
lore

Damien Le Moal

author maintainer
#0 lore raw

PATCH 1/1 ata: libata-core: relax checks in ata_read_log_directory()

Commit 6d4405b16d37 ("ata: libata-core: Cache the general purpose log directory") introduced caching of a device general purpose log directory to avoid repeated access to this log page during device scan. This change also added a check on this log page to verify that the log page version is 0x0001 as mandated by the ACS specifications.

And it turns out that some devices do not bother reporting this version, instead reporting a version 0, resulting in error messages such as:

ata6.00: Invalid log directory version 0x0000

and to the device being marked as not supporting the general purpose log directory log page.

Since before commit 6d4405b16d37 the log page version check did not exist and things were still working correctly for these devices, relax ata_read_log_directory() version check and only warn about the invalid log page version number without disabling access to the log directory page.

Fixes 6d4405b16d37 ("ata: libata-core: Cache the general purpose log directory")
---
 drivers/ata/libata-core.c | 11 ++++-------
 include/linux/libata.h    |  6 ++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/ata/libata-core.c +4 -7
index ff53f5f029b4..2a210719c4ce 100644
@@ -2174,13 +2174,10 @@ static int ata_read_log_directory(struct ata_device *dev)
 	}
 
 	version = get_unaligned_le16(&dev->gp_log_dir[0]);
-	if (version != 0x0001) {
-		ata_dev_err(dev, "Invalid log directory version 0x%04x\n",
-			    version);
-		ata_clear_log_directory(dev);
-		dev->quirks |= ATA_QUIRK_NO_LOG_DIR;
-		return -EINVAL;
-	}
+	if (version != 0x0001)
+		ata_dev_warn_once(dev,
+				  "Invalid log directory version 0x%04x\n",
+				  version);
 
 	return 0;
 }
include/linux/libata.h +6 -0
index 21de0935775d..7a98de1cc995 100644
@@ -1594,6 +1594,12 @@ do {								\
 #define ata_dev_dbg(dev, fmt, ...)				\
 	ata_dev_printk(debug, dev, fmt, ##__VA_ARGS__)
 
+#define ata_dev_warn_once(dev, fmt, ...)			\
+	pr_warn_once("ata%u.%02u: " fmt,			\
+		     (dev)->link->ap->print_id,			\
+		     (dev)->link->pmp + (dev)->devno,		\
+		     ##__VA_ARGS__)
+
 static inline void ata_print_version_once(const struct device *dev,
 					  const char *version)
 {
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 20 lines · Damien Le Moal

Commit 6d4405b16d37 ("ata: libata-core: Cache the general purpose log directory") introduced caching of a device general purpose log directory to avoid repeated access to this log page during device scan. This change also added a check on this log page to verify that the log page version is 0x0001 as mandated by the ACS specifications.

And it turns out that some devices do not bother reporting this version, instead reporting a version 0, resulting in error messages such as:

ata6.00: Invalid log directory version 0x0000

and to the device being marked as not supporting the general purpose log directory log page.

Since before commit 6d4405b16d37 the log page version check did not exist and things were still working correctly for these devices, relax ata_read_log_directory() version check and only warn about the invalid log page version number without disabling access to the log directory page.

Quoted 4 lines
Fixes 6d4405b16d37 ("ata: libata-core: Cache the general purpose log directory")

Looks good, will queue up after -rc1.

Kind regards,
Niklas

maintainer Applied
#2 lore raw
In reply to Damien Le Moal
Quoted 10 lines · Damien Le Moal

Commit 6d4405b16d37 ("ata: libata-core: Cache the general purpose log directory") introduced caching of a device general purpose log directory to avoid repeated access to this log page during device scan. This change also added a check on this log page to verify that the log page version is 0x0001 as mandated by the ACS specifications.

And it turns out that some devices do not bother reporting this version, instead reporting a version 0, resulting in error messages such as:

[...]

Applied to libata/linux.git (for-6.18-fixes), thanks!

[1/1] ata: libata-core: relax checks in ata_read_log_directory()

      https://git.kernel.org/libata/linux/c/12d724f2

Kind regards,
Niklas