diff --git a/smart-status/smart-status-lib.pl b/smart-status/smart-status-lib.pl index 13f19e2e1..9a859775b 100755 --- a/smart-status/smart-status-lib.pl +++ b/smart-status/smart-status-lib.pl @@ -342,18 +342,20 @@ foreach my $d (sort { $a->{'device'} cmp $b->{'device'} } return sort { $a->{'device'} cmp $b->{'device'} } @rv; } -=head2 get_drive_status(device-name, [&drive]) +=head2 get_drive_status(device-name, [&drive], [basic]) -Returns a hash reference containing the status of some drive +Returns a hash reference containing the status of some drive. If basic is set, +fetches attributes and the error log without self-test logs for background +temperature collection. =cut sub get_drive_status { -local ($device, $drive) = @_; +local ($device, $drive, $basic) = @_; if ($device =~ /^(\/dev\/nvme\d+)n\d+$/) { # For NVME drives, try the underlying device first local $nd = $1; - local $st = &get_drive_status($nd, $drive); + local $st = &get_drive_status($nd, $drive, $basic); return $st if ($st->{'support'} && $st->{'enabled'}); } local %rv; @@ -452,7 +454,12 @@ if ($config{'attribs'}) { local ($lastline, @attribs); local $doneknown = 0; $rv{'raw'} = ""; - open(OUT, "$config{'smartctl'} $extra_args -a $qd |"); + # Poll attributes and errors without requesting self-test logs, which + # can trigger resets on some USB bridges. Keep full details for callers + # that do not request basic status, and use legacy flags on old tools. + local $args = $basic ? (&get_smart_version() > 5.0 ? + "-A -l error" : "-vl") : "-a"; + open(OUT, "$config{'smartctl'} $extra_args $args $qd |"); while() { s/\r|\n//g; if (/Model\s+Family:\s+(.*)/i) { diff --git a/system-status/system-status-lib.pl b/system-status/system-status-lib.pl index ab047336b..43e9e20d7 100755 --- a/system-status/system-status-lib.pl +++ b/system-status/system-status-lib.pl @@ -450,7 +450,8 @@ if (!$config{'collect_notemp'} && &foreign_installed("smart-status")) { &foreign_require("smart-status"); foreach my $d (&smart_status::list_smart_disks_partitions()) { - my $st = &smart_status::get_drive_status($d->{'device'}, $d); + # Temperature collection does not need self-test logs. + my $st = &smart_status::get_drive_status($d->{'device'}, $d, 1); foreach my $a (@{$st->{'attribs'}}) { if (($a->[0] =~ /^Temperature\s+Celsius$/i || $a->[0] =~ /^Temperature$/i ||