mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Report smartctl open failures as unknown power state
This commit is contained in:
parent
720073d80d
commit
aa8445e7a9
5 changed files with 34 additions and 10 deletions
|
|
@ -1750,12 +1750,17 @@ retry:
|
|||
log_tag("attr:%s:%s:power:standby\n", file, name);
|
||||
*power = POWER_STANDBY;
|
||||
} else {
|
||||
log_tag("attr:%s:%s:power:active\n", file, name);
|
||||
*power = POWER_ACTIVE;
|
||||
|
||||
/* store the smartctl return value */
|
||||
if (smart)
|
||||
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
|
||||
|
||||
if (WEXITSTATUS(ret) & SMARTCTL_FLAG_OPEN) {
|
||||
log_tag("attr:%s:%s:power:unknown\n", file, name);
|
||||
*power = POWER_UNKNOWN;
|
||||
} else {
|
||||
log_tag("attr:%s:%s:power:active\n", file, name);
|
||||
*power = POWER_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -1913,7 +1918,8 @@ static int devdownifup(uint64_t device, const char* name, const char* smartctl,
|
|||
if (devprobe(device, name, smartctl, smartctl_info, power, 0, 0, 0, 0, 0, 0) != 0)
|
||||
return -1;
|
||||
|
||||
if (*power == POWER_ACTIVE)
|
||||
/* a failed probe may hide an active disk, so skip only confirmed standby */
|
||||
if (*power != POWER_STANDBY)
|
||||
return devdown(device, name, smartctl);
|
||||
|
||||
return 0;
|
||||
|
|
@ -2089,7 +2095,7 @@ static void* thread_spindownifup(void* arg)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (power == POWER_ACTIVE)
|
||||
if (power != POWER_STANDBY)
|
||||
msg_status("Spundown device '%s' for disk '%s' in %" PRIu64 " ms.\n", devinfo->file, devinfo->name, os_tick_ms() - start);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3797,12 +3797,17 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, const
|
|||
log_tag("attr:%s:%s:power:standby\n", file, name);
|
||||
*power = POWER_STANDBY;
|
||||
} else {
|
||||
log_tag("attr:%s:%s:power:active\n", file, name);
|
||||
*power = POWER_ACTIVE;
|
||||
|
||||
/* store the smartctl return value */
|
||||
if (smart)
|
||||
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
|
||||
|
||||
if (WEXITSTATUS(ret) & SMARTCTL_FLAG_OPEN) {
|
||||
log_tag("attr:%s:%s:power:unknown\n", file, name);
|
||||
*power = POWER_UNKNOWN;
|
||||
} else {
|
||||
log_tag("attr:%s:%s:power:active\n", file, name);
|
||||
*power = POWER_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -3929,7 +3934,8 @@ static int devdownifup(dev_t device, const char* name, const char* smartctl, con
|
|||
if (devprobe(device, name, smartctl, smartctl_info, power, 0, 0, 0, 0, 0, 0) != 0)
|
||||
return -1;
|
||||
|
||||
if (*power == POWER_ACTIVE)
|
||||
/* a failed probe may hide an active disk, so skip only confirmed standby */
|
||||
if (*power != POWER_STANDBY)
|
||||
return devdown(device, name, smartctl);
|
||||
|
||||
return 0;
|
||||
|
|
@ -4156,7 +4162,7 @@ static void* thread_spindownifup(void* arg)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (power == POWER_ACTIVE)
|
||||
if (power != POWER_STANDBY)
|
||||
msg_status("Spundown device '%s' for disk '%s' in %" PRIu64 " ms.\n", devinfo->file, devinfo->name, os_tick_ms() - start);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1866,6 +1866,10 @@ read.
|
|||
Logs a successful spin\-down operation initiated via the
|
||||
smartctl command.
|
||||
.TP
|
||||
.B attr:<device_file>:<disk_name>[/<split_index>]:power:unknown
|
||||
Logs that the device power state could not be determined
|
||||
after a status probe.
|
||||
.TP
|
||||
.B stat:<disk_name>:<access_number>
|
||||
Logs the total number of read and write accesses done on the
|
||||
disk. This is a cumulative value that include all the devices
|
||||
|
|
|
|||
|
|
@ -1170,6 +1170,10 @@ Command Smart And Probe Tags
|
|||
Logs a successful spin-down operation initiated via the
|
||||
smartctl command.
|
||||
|
||||
=attr:<device_file>:<disk_name>[/<split_index>]:power:unknown
|
||||
Logs that the device power state could not be determined
|
||||
after a status probe.
|
||||
|
||||
=stat:<disk_name>:<access_number>
|
||||
Logs the total number of read and write accesses done on the
|
||||
disk. This is a cumulative value that include all the devices
|
||||
|
|
|
|||
|
|
@ -1216,6 +1216,10 @@ Tags logging specific disk identification and attribute values.
|
|||
Logs a successful spin-down operation initiated via the
|
||||
smartctl command.
|
||||
|
||||
attr:<device_file>:<disk_name>[/<split_index>]:power:unknown
|
||||
Logs that the device power state could not be determined
|
||||
after a status probe.
|
||||
|
||||
stat:<disk_name>:<access_number>
|
||||
Logs the total number of read and write accesses done on the
|
||||
disk. This is a cumulative value that include all the devices
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue