Skip to content
Snippets Groups Projects
Commit d7e67ef3 authored by ballen4705's avatar ballen4705
Browse files

Previous versions of this code (and Smartsuite) only generate

SMART failure errors if the value of an attribute is below the
threshold and the prefailure bit is set.  However the ATA Spec
(ATA4 <=Rev 4) says that it is a SMART failure if the value of an
attribute is LESS THAN OR EQUAL to the threshold and the
prefailure bit is set.  This is now fixed in both smartctl and
smartd.

smartd did not print the correct value of any failing SMART attribute.  It
printed the index in the attribute table, not the attribute
ID. This is fixed.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@73 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent c1617f14
No related branches found
No related tags found
No related merge requests found
CHANGELOG for smartmontools CHANGELOG for smartmontools
$Id: CHANGELOG,v 1.11 2002/10/21 15:07:47 ballen4705 Exp $ $Id: CHANGELOG,v 1.12 2002/10/21 16:00:46 ballen4705 Exp $
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
...@@ -29,6 +29,18 @@ NOTES FOR NEXT RELEASE: ...@@ -29,6 +29,18 @@ NOTES FOR NEXT RELEASE:
smartmontools-5.0-11 smartmontools-5.0-11
Previous versions of this code (and Smartsuite) only generate
SMART failure errors if the value of an attribute is below the
threshold and the prefailure bit is set. However the ATA Spec
(ATA4 <=Rev 4) says that it is a SMART failure if the value of an
attribute is LESS THAN OR EQUAL to the threshold and the
prefailure bit is set. This is now fixed in both smartctl and
smartd.
smartd did not print the correct value of any failing SMART attribute. It
printed the index in the attribute table, not the attribute
ID. This is fixed.
when starting self-tests in captive mode ioctl returns EIO because when starting self-tests in captive mode ioctl returns EIO because
the drive has been busied out. Detect this and don't return an eror the drive has been busied out. Detect this and don't return an eror
in this case. Check this this is correct (or how to fix it?) in this case. Check this this is correct (or how to fix it?)
......
...@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net ...@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
$Id: TODO,v 1.8 2002/10/20 19:40:23 ballen4705 Exp $ $Id: TODO,v 1.9 2002/10/21 16:00:46 ballen4705 Exp $
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
...@@ -33,9 +33,14 @@ Produce version for ATA/ATAPI-7 ...@@ -33,9 +33,14 @@ Produce version for ATA/ATAPI-7
Modifications Modifications
------------- -------------
Add option to show if the WORST recorded value is ever <= threshold
and if this is true with for an non-prefailure or prefailure attribute.
Command line option to specify devices to look for in smartd startup Command line option to specify devices to look for in smartd startup
Print flags meanings in Vendor Attribute list -- not hex value Print flags meanings in Vendor Attribute list -- not hex value --
especially for prefailure flag.
When actual attribute(s) less than threshold, print these clearly (highlighted) When actual attribute(s) less than threshold, print these clearly (highlighted)
......
// $Id: atacmds.c,v 1.12 2002/10/21 15:07:48 ballen4705 Exp $ // $Id: atacmds.c,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */ ...@@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */
"reserved" /* 0x001f-0xfffe*/ "reserved" /* 0x001f-0xfffe*/
}; };
// NOTE ATA/ATAPI-4 REV 4 was the LAST revision where the device
// attribute structures were NOT completely vendor specific. So any
// disk that is ATA/ATAPI-4 or above can not be trusted to show the
// vendor values in sensible format.
const int actual_ver[] = { const int actual_ver[] = {
/* word 81 value: */ /* word 81 value: */
0, /* 0x0000 WARNING: */ 0, /* 0x0000 WARNING: */
...@@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){ ...@@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){
// Loop over all valid attributes. If they are prefailure attributes // Loop over all valid attributes. If they are prefailure attributes
// and are below the threshold value, then return the index of the // and are at or below the threshold value, then return the ID of the
// lowest failing attribute. Return 0 if all prefailure attributes // first failing attribute found. Return 0 if all prefailure
// are in bounds. // attributes are in bounds. The spec says "Bit 0
// -Pre-failure/advisory - If the value of this bit equals zero, an
// attribute value less than or equal to its corresponding attribute
// threshold indicates an advisory condition where the usage or age of
// the device has exceeded its intended design life period. If the
// value of this bit equals one, an atribute value less than or equal
// to its corresponding attribute threshold indicates a pre-failure
// condition where imminent loss of data is being predicted."
int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){
int i; int i;
...@@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr ...@@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr
if (data.vendor_attributes[i].id && if (data.vendor_attributes[i].id &&
thresholds.thres_entries[i].id && thresholds.thres_entries[i].id &&
data.vendor_attributes[i].status.flag.prefailure && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)) (thresholds.thres_entries[i].threshold != 0xFE))
return i; return data.vendor_attributes[i].id;
} }
return 0; return 0;
} }
// $Id: atacmds.cpp,v 1.12 2002/10/21 15:07:48 ballen4705 Exp $ // $Id: atacmds.cpp,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */ ...@@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */
"reserved" /* 0x001f-0xfffe*/ "reserved" /* 0x001f-0xfffe*/
}; };
// NOTE ATA/ATAPI-4 REV 4 was the LAST revision where the device
// attribute structures were NOT completely vendor specific. So any
// disk that is ATA/ATAPI-4 or above can not be trusted to show the
// vendor values in sensible format.
const int actual_ver[] = { const int actual_ver[] = {
/* word 81 value: */ /* word 81 value: */
0, /* 0x0000 WARNING: */ 0, /* 0x0000 WARNING: */
...@@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){ ...@@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){
// Loop over all valid attributes. If they are prefailure attributes // Loop over all valid attributes. If they are prefailure attributes
// and are below the threshold value, then return the index of the // and are at or below the threshold value, then return the ID of the
// lowest failing attribute. Return 0 if all prefailure attributes // first failing attribute found. Return 0 if all prefailure
// are in bounds. // attributes are in bounds. The spec says "Bit 0
// -Pre-failure/advisory - If the value of this bit equals zero, an
// attribute value less than or equal to its corresponding attribute
// threshold indicates an advisory condition where the usage or age of
// the device has exceeded its intended design life period. If the
// value of this bit equals one, an atribute value less than or equal
// to its corresponding attribute threshold indicates a pre-failure
// condition where imminent loss of data is being predicted."
int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){
int i; int i;
...@@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr ...@@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr
if (data.vendor_attributes[i].id && if (data.vendor_attributes[i].id &&
thresholds.thres_entries[i].id && thresholds.thres_entries[i].id &&
data.vendor_attributes[i].status.flag.prefailure && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)) (thresholds.thres_entries[i].threshold != 0xFE))
return i; return data.vendor_attributes[i].id;
} }
return 0; return 0;
} }
// $Id: ataprint.c,v 1.13 2002/10/20 19:22:02 ballen4705 Exp $ // $Id: ataprint.c,v 1.14 2002/10/21 16:00:48 ballen4705 Exp $
/* /*
* ataprint.c * ataprint.c
* *
...@@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data, ...@@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data,
if (data.vendor_attributes[i].id && if (data.vendor_attributes[i].id &&
thresholds.thres_entries[i].id && thresholds.thres_entries[i].id &&
data.vendor_attributes[i].status.flag.prefailure && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)){ (thresholds.thres_entries[i].threshold != 0xFE)){
printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id); printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id);
failed = 1; failed = 1;
......
// $Id: ataprint.cpp,v 1.13 2002/10/20 19:22:02 ballen4705 Exp $ // $Id: ataprint.cpp,v 1.14 2002/10/21 16:00:48 ballen4705 Exp $
/* /*
* ataprint.c * ataprint.c
* *
...@@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data, ...@@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data,
if (data.vendor_attributes[i].id && if (data.vendor_attributes[i].id &&
thresholds.thres_entries[i].id && thresholds.thres_entries[i].id &&
data.vendor_attributes[i].status.flag.prefailure && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)){ (thresholds.thres_entries[i].threshold != 0xFE)){
printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id); printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id);
failed = 1; failed = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment