Opened 2 years ago

Closed 2 years ago

Last modified 11 months ago

#943 closed defect (fixed)

NetBSD regression in smartmontools 6.6

Reported by: Alex Samorukov Owned by:
Priority: critical Milestone: Release 7.0
Component: all Version: 6.6
Keywords: netbsd bigendian Cc:

Description (last modified by Alex Samorukov)

Smartctl is broken on netbsd/sparc64 (BE) arch

To test if smartctl still works on be i installed NetBSD7.0/sparc64 in the qemu.

It was found that smart support is mostly broken.

bash-4.4# uname -a
NetBSD netbsd 7.0 NetBSD 7.0 (GENERIC.201509250726Z) sparc64
bash-4.4# ./smartctl -d ata /dev/wd0c -A
smartctl 6.7 2017-11-16 r4625 [NetBSD 7.0 sparc64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

Read SMART Data failed: request failed, error code 0x02

=== START OF READ SMART DATA SECTION ===
bash-4.4# ./smartctl -d ata /dev/wd0c -Ai
smartctl 6.7 2017-11-16 r4625 [NetBSD 7.0 sparc64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     QEMU HARDDISK
Serial Number:    QM00001
Firmware Version: 2.5+
User Capacity:    5,368,709,120 bytes [5.36 GB]
Sector Size:      512 bytes logical/physical
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA/ATAPI-7, ATA/ATAPI-5 published, ANSI NCITS 340-2000
Local Time is:    Sun Nov 19 10:35:54 2017 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Read SMART Data failed: request failed, error code 0x02

=== START OF READ SMART DATA SECTION ===

At the same time native tool works correctly:

bash-4.4# atactl wd0 smart status
SMART supported, SMART enabled
id value thresh crit collect reliability description                 raw
  1 100    6     yes online  positive    Raw read error rate         0
  3 100    0     yes online  positive    Spin-up time                16
  4 100   20     no  online  positive    Start/stop count            100
  5 100   36     yes online  positive    Reallocated sector count    0
  9 100    0     yes online  positive    Power-on hours count        1
 12 100    0     yes online  positive    Device power cycle count    0
190  69   50     yes online  positive    Airflow Temperature         31 Lifetime min/max 31/0

Links:

Todo:

  1. install NetBSD 7.0 intel to check if bug is BE/sparc specific, check atactl code for the hints.
  2. Check previous smartmontools version (6.5)

Autodetection is broken in smartmontools 6.6/netbsd

sparc64# ./smartctl /dev/wd0c
smartctl 6.7 2017-11-16 r4625 [NetBSD 7.0 sparc64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/wd0c: Unable to detect device type
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

Code in the netbsd_smart_interface::autodetect_smart_device(const char * name) is very wrong

Change History (18)

comment:1 Changed 2 years ago by Alex Samorukov

Description: modified (diff)

comment:2 Changed 2 years ago by Christian Franke

Milestone: unscheduled

Did previous versions ever work on any NetBSD*/sparc64 ?

comment:3 Changed 2 years ago by Alex Samorukov

Did previous versions ever work on any NetBSD*/sparc64 ?

Thats why i want to do more testing :)

comment:4 Changed 2 years ago by Alex Samorukov

Description: modified (diff)

comment:5 Changed 2 years ago by Alex Samorukov

Issue is BE specific, same test on same qemu version but with netbsdi386 works just fine:

bash-4.4# ./smartctl -d ata /dev/wd0d  -A
smartctl 6.7 2017-11-18 r4627 [NetBSD 7.0.2 i386] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x0003   100   100   006    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0003   100   100   000    Pre-fail  Always       -       16
  4 Start_Stop_Count        0x0002   100   100   020    Old_age   Always       -       100
  5 Reallocated_Sector_Ct   0x0003   100   100   036    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0003   100   100   000    Pre-fail  Always       -       1
 12 Power_Cycle_Count       0x0003   100   100   000    Pre-fail  Always       -       0
190 Airflow_Temperature_Cel 0x0003   069   069   050    Pre-fail  Always       -       31 (Min/Max 31/31)

comment:6 Changed 2 years ago by Alex Samorukov

Related to #117

comment:7 Changed 2 years ago by Alex Samorukov

Issue found:

req.cylinder = le16toh(in.in_regs.lba_mid | (in.in_regs.lba_high << 8));

Should be just

req.cylinder = in.in_regs.lba_mid | (in.in_regs.lba_high << 8);

Order is not changed here.

Last edited 2 years ago by Alex Samorukov (previous) (diff)

comment:8 Changed 2 years ago by Alex Samorukov

Priority: minorcritical

comment:9 Changed 2 years ago by Alex Samorukov

Bug introduced recently:

  req.cylinder = le16toh(in.in_regs.lba_mid | (in.in_regs.lba_high << 8));

was

   req.cylinder = WDSMART_CYL;

Which is a static value. I will try to check if there are other issues introduced by the patch

comment:10 Changed 2 years ago by Alex Samorukov

Also auto-detection in patch is broken :( we should request more testing on such big patches.

comment:11 Changed 2 years ago by Alex Samorukov

Description: modified (diff)
Summary: Smartctl is broken on netbsd/sparc64 (BE) archNetBSD regression in smartmontools 6.6

comment:12 Changed 2 years ago by Alex Samorukov

Description: modified (diff)

comment:13 Changed 2 years ago by Alex Samorukov

Fixed in r4628

comment:14 Changed 2 years ago by Alex Samorukov

Resolution: fixed
Status: newclosed

comment:15 Changed 2 years ago by Alex Samorukov

Keywords: bigendian added

comment:16 Changed 2 years ago by Christian Franke

Milestone: unscheduledRelease 6.7

comment:17 Changed 15 months ago by Christian Franke

r4628 was backported to smartmontools 6.6 in NetBSD Package smartmontools-6.6nb1.

comment:18 Changed 11 months ago by Christian Franke

Milestone: Release 6.7Release 7.0

Milestone renamed

Note: See TracTickets for help on using tickets.