Commit f7270e02 authored by chrfranke's avatar chrfranke
Browse files

smartd: Don't disable attribute tracking if read thresholds fails.

Windows: Don't return dummy thresholds if IOCTL_STORAGE_QUERY_PROPERTY
or 3ware CLI is used to read SMART data.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3039 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 391fab8f
...@@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file. ...@@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[CF] smartd: Don't disable attribute tracking if read thresholds fails.
Windows: Don't return dummy thresholds if IOCTL_STORAGE_QUERY_PROPERTY
or 3ware CLI is used to read SMART data.
[CF] Windows: Print warning if admin rights are missing. [CF] Windows: Print warning if admin rights are missing.
[CF] Replace some 'EXIT(status)' calls by 'return status'. [CF] Replace some 'EXIT(status)' calls by 'return status'.
......
...@@ -1708,20 +1708,6 @@ int win_tw_cli_device::ata_command_interface(smart_command_set command, int /*se ...@@ -1708,20 +1708,6 @@ int win_tw_cli_device::ata_command_interface(smart_command_set command, int /*se
break; break;
memcpy(data, &m_smart_buf, 512); memcpy(data, &m_smart_buf, 512);
return 0; return 0;
case READ_THRESHOLDS:
if (!m_smart_valid)
break;
// Fake zero thresholds
{
const ata_smart_values * sv = &m_smart_buf;
ata_smart_thresholds_pvt * tr = (ata_smart_thresholds_pvt *)data;
memset(tr, 0, 512);
// TODO: Indicate missing thresholds in ataprint.cpp:PrintSmartAttribWithThres()
// (ATA_SMART_READ_THRESHOLDS is marked obsolete since ATA-5)
for (int i = 0; i < NUMBER_ATA_SMART_ATTRIBUTES; i++)
tr->chksum -= tr->thres_entries[i].id = sv->vendor_attributes[i].id;
}
return 0;
case ENABLE: case ENABLE:
case STATUS: case STATUS:
case STATUS_CHECK: // Fake "good" SMART status case STATUS_CHECK: // Fake "good" SMART status
...@@ -2771,31 +2757,19 @@ bool win_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out) ...@@ -2771,31 +2757,19 @@ bool win_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
if (rc > 0) if (rc > 0)
rc = 0; rc = 0;
break; break;
case ATA_SMART_READ_THRESHOLDS:
{
ata_smart_values sv;
rc = storage_predict_failure_ioctl(get_fh(), (char *)&sv);
if (rc < 0)
break;
rc = 0;
// Fake zero thresholds
ata_smart_thresholds_pvt * tr = (ata_smart_thresholds_pvt *)data;
memset(tr, 0, 512);
for (int i = 0; i < NUMBER_ATA_SMART_ATTRIBUTES; i++)
tr->chksum -= tr->thres_entries[i].id = sv.vendor_attributes[i].id;
}
break;
case ATA_SMART_ENABLE: case ATA_SMART_ENABLE:
rc = 0; rc = 0;
break; break;
case ATA_SMART_STATUS: case ATA_SMART_STATUS:
rc = storage_predict_failure_ioctl(get_fh()); rc = storage_predict_failure_ioctl(get_fh());
if (rc >= 0) { if (rc == 0) {
if (rc > 0) { // Good SMART status
regs.bCylHighReg = 0x2c; regs.bCylLowReg = 0xf4; out.out_regs.lba_high = 0xc2; out.out_regs.lba_mid = 0x4f;
rc = 0; }
} else if (rc > 0) {
out_regs_set = true; // Bad SMART status
out.out_regs.lba_high = 0x2c; out.out_regs.lba_mid = 0xf4;
rc = 0;
} }
break; break;
default: default:
......
...@@ -1698,23 +1698,29 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade ...@@ -1698,23 +1698,29 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
// information was ALSO reproduced in the IDENTIFY DEVICE response, // information was ALSO reproduced in the IDENTIFY DEVICE response,
// but sadly not for ATA-5. Sigh. // but sadly not for ATA-5. Sigh.
// do we need to retain SMART data after returning from this routine?
bool retainsmartdata = (cfg.usagefailed || cfg.prefail || cfg.usage || cfg.tempdiff || cfg.tempinfo || cfg.tempcrit);
// do we need to get SMART data? // do we need to get SMART data?
bool smart_val_ok = false; bool smart_val_ok = false;
if ( retainsmartdata || cfg.autoofflinetest || cfg.selftest || cfg.errorlog if ( cfg.autoofflinetest || cfg.errorlog || cfg.selftest
|| cfg.curr_pending_id || cfg.offl_pending_id ) { || cfg.usagefailed || cfg.prefail || cfg.usage
|| cfg.tempdiff || cfg.tempinfo || cfg.tempcrit
if (ataReadSmartValues(atadev, &state.smartval) || || cfg.curr_pending_id || cfg.offl_pending_id ) {
ataReadSmartThresholds (atadev, &state.smartthres)) {
PrintOut(LOG_INFO,"Device: %s, Read SMART Values and/or Thresholds Failed\n",name); if (ataReadSmartValues(atadev, &state.smartval)) {
retainsmartdata = cfg.usagefailed = cfg.prefail = cfg.usage = false; PrintOut(LOG_INFO, "Device: %s, Read SMART Values failed\n", name);
cfg.usagefailed = cfg.prefail = cfg.usage = false;
cfg.tempdiff = cfg.tempinfo = cfg.tempcrit = 0; cfg.tempdiff = cfg.tempinfo = cfg.tempcrit = 0;
cfg.curr_pending_id = cfg.offl_pending_id = 0; cfg.curr_pending_id = cfg.offl_pending_id = 0;
} }
else else {
smart_val_ok = true; smart_val_ok = true;
if (ataReadSmartThresholds(atadev, &state.smartthres)) {
PrintOut(LOG_INFO, "Device: %s, Read SMART Thresholds failed%s\n",
name, (cfg.usagefailed ? ", ignoring -f Directive" : ""));
cfg.usagefailed = false;
// Let ata_get_attr_state() return ATTRSTATE_NO_THRESHOLD:
memset(&state.smartthres, 0, sizeof(state.smartthres));
}
}
// see if the necessary Attribute is there to monitor offline or // see if the necessary Attribute is there to monitor offline or
// current pending sectors or temperature // current pending sectors or temperature
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment