Hi all,
i recently noticed that on my oldish Fujitsu Primergy Server with a C602
SAS controller and SATA disks, I would get strange SMART results from
smartctl:
=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers
missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.
instead of
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
The last known working kernel was 6.6.47, the first kernel where I noted
the error messages was 6.6.62.
Additionally, when retrieving the SMART data, the kernel would log:
Nov 21 12:47:24 mischa kernel: sas: Enter sas_scsi_recover_host busy: 1
failed: 1
Nov 21 12:47:24 mischa kernel: sas: ata3: end_device-0:2: cmd error handler
Nov 21 12:47:24 mischa kernel: sas: ata1: end_device-0:0: dev error handler
Nov 21 12:47:24 mischa kernel: sas: ata2: end_device-0:1: dev error handler
Nov 21 12:47:24 mischa kernel: sas: ata4: end_device-0:3: dev error handler
Nov 21 12:47:24 mischa kernel: sas: ata3: end_device-0:2: dev error handler
Nov 21 12:47:24 mischa kernel: sas: --- Exit sas_scsi_recover_host:
busy: 0 failed: 1 tries: 1
Today, I was able to narrow the problem down to the following kernel
patch, first introduced into 6.6.51:
From 872f86e1757bbb0a334ee739b824e47c448f5ebc Mon Sep 17 00:00:00 2001
From: Igor Pylypiv <ipylypiv@xxxxxxxxxx>
Date: Tue, 2 Jul 2024 02:47:35 +0000
Subject: ata: libata-scsi: Check ATA_QCFLAG_RTF_FILLED before using
result_tf
[ Upstream commit 816be86c7993d3c5832c3017c0056297e86f978c ]
qc->result_tf contents are only valid when the ATA_QCFLAG_RTF_FILLED flag
is set. The ATA_QCFLAG_RTF_FILLED flag should be always set for commands
that failed or for commands that have the ATA_QCFLAG_RESULT_TF flag set.
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
Reviewed-by: Niklas Cassel <cassel@xxxxxxxxxx>
Signed-off-by: Igor Pylypiv <ipylypiv@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20240702024735.1152293-8-ipylypiv@xxxxxxxxxx
Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/ata/libata-scsi.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
(limited to 'drivers/ata/libata-scsi.c')
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 27e0c87236ac04..c91f8746289f4a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -242,10 +242,17 @@ void ata_scsi_set_sense_information(struct
ata_device *dev,
*/
static void ata_scsi_set_passthru_sense_fields(struct ata_queued_cmd *qc)
{
+ struct ata_device *dev = qc->dev;
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
unsigned char *sb = cmd->sense_buffer;
+ if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
+ ata_dev_dbg(dev,
+ "missing result TF: can't set ATA PT sense fields\n");
+ return;
+ }
+
if ((sb[0] & 0x7f) >= 0x72) {
unsigned char *desc;
u8 len;
@@ -924,10 +931,17 @@ static void ata_to_sense_error(unsigned id, u8
drv_stat, u8 drv_err, u8 *sk,
*/
static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
{
+ struct ata_device *dev = qc->dev;
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
u8 sense_key, asc, ascq;
+ if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
+ ata_dev_dbg(dev,
+ "missing result TF: can't generate ATA PT sense data\n");
+ return;
+ }
+
/*
* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
@@ -979,6 +993,13 @@ static void ata_gen_ata_sense(struct ata_queued_cmd
*qc)
ata_scsi_set_sense(dev, cmd, NOT_READY, 0x04, 0x21);
return;
}
+
+ if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
+ ata_dev_dbg(dev,
+ "missing result TF: can't generate sense data\n");
+ return;
+ }
+
/* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/
--
cgit 1.2.3-korg
I reverted this patch on this system and the problem has gone away. I
have not enough kernel debugging skills to dig deeper into it. Does
anybody have ideas?
Thanks in advance
Christian