From 457386b2343acaa50169e7b077f83f44acd80bc2 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 22 Nov 2023 16:19:43 +0100 Subject: [PATCH] don't report new non-device related errors as critical (#RHEL-6982) Resolves: #RHEL-6982 --- drivedb.h | 137 ++++++++++----- smartmontools-7.4-r5121.patch | 200 ++++++++++++++++++++++ smartmontools-7.4-r5471.patch | 312 ++++++++++++++++++++++++++++++++++ smartmontools-7.4-r5472.patch | 159 +++++++++++++++++ smartmontools.spec | 23 ++- 5 files changed, 782 insertions(+), 49 deletions(-) create mode 100644 smartmontools-7.4-r5121.patch create mode 100644 smartmontools-7.4-r5471.patch create mode 100644 smartmontools-7.4-r5472.patch diff --git a/drivedb.h b/drivedb.h index 492dc96..152b503 100644 --- a/drivedb.h +++ b/drivedb.h @@ -224,8 +224,9 @@ const drive_settings builtin_knowndrives[] = { //"-v 194,tempminmax,Temperature_Celsius " //"-v 241,raw48,Total_LBAs_Written " }, - { "Apacer AS340 SSDs", - "Apacer AS340 (120|240|480|960)GB", // tested with Apacer AS340 120GB/AP612PE0 + { "Apacer AS340/350 SSDs", + "Apacer AS3[45]0 ((12[08]|240|256|480|512|960)G|1T)B", // tested with + // Apacer AS340 120GB/AP612PE0, Apacer AS350 1TB/AP613PE0 "", "", //"-v 9,raw24(raw8),Power_On_Hours " //"-v 12,raw48,Power_Cycle_Count " @@ -244,8 +245,10 @@ const drive_settings builtin_knowndrives[] = { }, { "Apacer SSDs", "([1248]|1[056]|20|3[02]|40|60|64|80|12[08]|160|240|256|320|480|512|640|960|1024|1280|1920|2048|3840|4096)(GB|TB) SATA Flash Drive|" - "S[GHTV]250-(M2[48][02]|25) ([1248]|1[056]|20|3[02]|40|60|64|80|12[08]|160|240|256|320|480|512|640|960|1024|1280|1920|2048|3840|4096)(GB|TB) SSD", // tested with 120GB SATA Flash Drive/SFMB6130, SH250-M242 128GB SSD/SFMB8120, ST250-M280 256GB SSD/SFMD6110 - "SFM[BCDEGHJ][0-9A-Z][0-9A-Z][1-9A-Z][0-9A-Z]", + "1TB SATA SSD|" // tested with 1TB SATA SSD/AP613PE0 (AP1TPPSS25-R) + "S[GHTV]250-(M2[48][02]|25) ([1248]|1[056]|20|3[02]|40|60|64|80|12[08]|160|240|256|320|480|512|640|960|1024|1280|1920|2048|3840|4096)(GB|TB) SSD", + // tested with 120GB SATA Flash Drive/SFMB6130, SH250-M242 128GB SSD/SFMB8120, ST250-M280 256GB SSD/SFMD6110 + "AP613PE0|SFM[BCDEGHJ][0-9A-Z][0-9A-Z][1-9A-Z][0-9A-Z]", "", //"-v 9,raw24(raw8),Power_On_Hours " //"-v 12,raw48,Power_Cycle_Count " @@ -287,8 +290,9 @@ const drive_settings builtin_knowndrives[] = { //"-v 199,raw48,UDMA_CRC_Error_Count " //"-v 240,raw48,Unknown_SSD_Attribute " }, - { "ATP SATA III aMLC M.2 2242 Embedded SSD", - "ATP I-Temp M\\.2 2242", // tested with ATP I-Temp M.2 2242/R0822A + { "ATP SATA III aMLC M.2 2242/80 Embedded SSDs", + "ATP I-Temp M\\.2 22(42|80)", // tested with ATP I-Temp M.2 2242/R0822A, + // ATP I-Temp M.2 2280/R0822A "","", "-v 1,raw48,Raw_Read_Error_Count " //"-v 5,raw16(raw16),Reallocated_Sector_Ct " @@ -324,6 +328,8 @@ const drive_settings builtin_knowndrives[] = { { "Crucial/Micron RealSSD C300/P300", // Marvell 88SS9174 "C300-CTFDDA[AC](064|128|256)MAG|" // tested with C300-CTFDDAC128MAG/0002, // C300-CTFDDAC064MAG/0006 + "(C300-)?MTFDBAK(064|128|256)MAG(-1G1)?|" // tested with + // C300-MTFDBAK128MAG/0006 (attr 9 only), MTFDBAK256MAG-1G1/0007 "P300-MTFDDAC(050|100|200)SAL", // tested with P300-MTFDDAC100SAL/0003 "", "", //"-v 1,raw48,Raw_Read_Error_Rate " @@ -512,7 +518,8 @@ const drive_settings builtin_knowndrives[] = { { "Micron 5100 / 52x0 / 5300 / 5400 SSDs", "(Micron_5100_)?(EE|MT)FDDA[KV](240|480|960|1T9|3T8|7T6)T(BY|CB|CC)|" // Matches both stock and Dell OEM // tested with Micron_5100_MTFDDAK3T8TCB/D0MU410, MTFDDAK3T8TCB/D0MU410 - "(Micron_5200_)?MTFDDAK(480|960|1T9|3T8|7T6)TD(C|D|N)|" // tested with Micron_5200_MTFDDAK3T8TDD/D1MU505 + "(Micron_5200_)?MTFDDAK(240|480|960|1T9|3T8|7T6)TD(C|D|N)|" // tested with Micron_5200_MTFDDAK240TDN/D1MU005, + // Micron_5200_MTFDDAK3T8TDD/D1MU505 "Micron_5210_MTFDDAK(480|960|1T9|3T8|7T6)QDE|" // tested with Micron_5210_MTFDDAK7T6QDE/D2MU804 "Micron_5300(HC)?_MTFDDA[KV](240|480|960|1T9|3T8|7T6)TD[STU]|" // tested with Micron_5300_MTFDDAK1T9TDS/D3MU001 // Micron_5300HC_MTFDDAK960TDS/D3MN010 @@ -742,7 +749,8 @@ const drive_settings builtin_knowndrives[] = { }, { "Phison Driven SSDs", // see MKP_521_Phison_SMART_attribute.pdf "BP4 mSATA SSD|" // MyDigital BP4, tested with BP4 mSATA SSD/S8FM06.9 - "Corsair Force LE200 SSD|" // tested with Corsair Force LE200 SSD/SBFM10, .../SBFM60.9 + "Corsair Force LE(200)? SSD|" // tested with Corsair Force LE SSD/SAFC11.0, + // Corsair Force LE200 SSD/SBFM10, .../SBFM60.9 "GIGABYTE GP-GSTFS31((120|240|256|480)G|100T)NTD|" // tested with GIGABYTE GP-GSTFS31120GNTD/SBFM61.3 "GOODRAM IRIDIUM PRO|" // tested with GOODRAM IRIDIUM PRO/SAFM01.5 "IRP?-SSDPR-S25[AC]-(120|240|256|480|512|960|0[12]T)|" // Goodram IRIDM (PRO), tested with @@ -769,12 +777,13 @@ const drive_settings builtin_knowndrives[] = { // Silicon Motion controller (see ticket #801), tested with // KINGSTON SA400S37240G/SBFK10D7, KINGSTON SA400S37120G/SBFK71E0, */SBFKB1D1 // KINGSTON SA400S37480G/SBFK10D7 (two spaces), KINGSTON SA400M8240G/SBFK61E1 - "Patriot (Blast|Blaze|Flare)|" // tested with Patriot Blast/SAFM11.3, Patriot Blaze/S9FM02, - // Patriot Flare/SBFM91.2 + "Patriot (Blast|Blaze|Flare|Ignite)|" // tested with Patriot Blast/SAFM11.3, + // Patriot Blaze/S9FM02, Patriot Flare/SBFM91.2, Patriot Ignite/SAFM01.7 "Patriot Burst( (120|240|480|960)GB)?|" // tested with Patriot Burst/SBFM11.2, // Patriot Burst 480GB/SBFMLA.5 - "PNY CS(900|1311|2211) (120|240|480|960)GB SSD|" // tested with PNY CS900 120GB SSD/CS900612, - // PNY CS900 240GB SSD/CS900613, PNY CS1311 120GB SSD/CS131122, PNY CS2211 240GB SSD/CS221016 + "PNY CS(900|1311|2211) (120|240|480|500|960)GB SSD|" // tested with PNY CS900 120GB SSD/CS900612, + // PNY CS900 240GB SSD/CS900613, PNY CS900 500GB SSD/CS900Y13, PNY CS1311 120GB SSD/CS131122, + // PNY CS2211 240GB SSD/CS221016 (CS900 1TB has different attribute set) "PNY ELITE PSSD|" // tested with PNY ELITE PSSD/CS105P13 (240G) "SSD Smartbuy (60|64|120|128|240|256|480|512|960|1024|2000)GB|" // PS3111-S11, tested with // SSD Smartbuy 240GB/SBFM91.1, SSD Smartbuy 64GB/SBFM21.1 @@ -827,14 +836,15 @@ const drive_settings builtin_knowndrives[] = { // weak information in the model. Detection is based on Firmware. { "Phison Driven OEM SSDs", // see MKP_521_Phison_SMART_attribute.pdf "GOODRAM|" // tested with GOODRAM CX200 (GOODRAM/SAFM12.2) - "Hoodisk SSD|" // tested with Hoodisk SSD/SBFM01.3 + "Hoodisk SSD|" // tested with Hoodisk SSD/SBFM01.3, Hoodisk SSD/SBFMJ1.3 "INTENSO|" // tested with Intenso SSD SATA III Top (INTENSO/S9FM02.6, .../SAFM01.6) "INTENSO SATA III SSD|" // tested with INTENSO SATA III SSD/SBFM11.2, .../SBFM81.3 + "Kingmax SATA SSD (120|240|480|960)GB|" // tested with Kingmax SATA SSD 240GB/SBFMY1.3 "SATA SSD|" // tested with Supermicro SSD-DM032-PHI (SATA SSD/S9FM02.1), // PC Engines msata16d (SATA SSD/S9FM02.3), FoxLine flssd240x4s(SATA SSD/SBFM10.5) "SPCC Solid State Disk", // Silicon Power, tested with SPCC Solid State Disk/SBFD00.3, // SPCC Solid State Disk/SBFM61.2, SPCC Solid State Disk/SBFMT1.3 - "S[89AB]F[DM][0-9T][0-9]\\.[0-9]", + "S[89AB]F[DM][0-9JTY][0-9]\\.[0-9]", "", //"-v 1,raw48,Raw_Read_Error_Rate " "-v 2,raw48,Not_In_Use " @@ -1390,10 +1400,10 @@ const drive_settings builtin_knowndrives[] = { "-v 249,raw48,NAND_Writes_1GiB" }, { "Intel 53x and Pro 1500/2500 Series SSDs", // SandForce SF-2281, tested with - // INTEL SSDSC2BW180A4/DC12, SSDSC2BW240A4/DC12, SSDMCEAW120A4/DC33 - // INTEL SSDMCEAW240A4/DC33, SSDSC2BF480A5/TG26, SSDSC2BW240H6/RG21 - // INTEL SSDSC2BF180A4H/LH6i - "INTEL SSD(MCEA|SC2B|SCKJ)[WF](056|080|120|180|240|360|480)(A4H?|A5|H6)", + // INTEL SSDSC2BW180A4/DC12, INTEL SSDSC2BW240A4/DC12, INTEL SSDMCEAW120A4/DC33, + // INTEL SSDMCEAW240A4/DC33, INTEL SSDSC2BF180A4H/LH6i, INTEL SSDSC2BF480A5/TG26, + // INTEL SSDSC2BF240A5L/LT2i, INTEL SSDSC2BW240H6/RG21 + "INTEL SSD(MCEA|SC2B|SCKJ)[WF](056|080|120|180|240|360|480)(A4H?|A5L?|H6)", // SC2B = 2.5", MCEA = mSATA, SCKJ = M.2; A4 = 530/Pro 1500, A5 = Pro 2500, H6 = 535 "", "", //"-v 5,raw16(raw16),Reallocated_Sector_Ct " @@ -1489,18 +1499,21 @@ const drive_settings builtin_knowndrives[] = { // INTEL SSDSC2BB800G4T, SSDSC2BA200G3/5DV10250, SSDSC2BB080G6/G2010130, SSDSC2BX200G4/G2010110, // INTEL SSDSC2BB016T6/G2010140, SSDSC2BX016T4/G2010140, SSDSC2BB150G7/N2010101, // INTEL SSDSC2BB480H4/D2010380, INTEL SSDSC2BB240G4C/D201FJ14, INTEL SSDSC2BA800G3E/5DV10250 - "INTEL SSDSC(1N|2B)[ABPX]((080|100|120|150|160|200|240|300|400|480|600|800)[GH][3467][CERT]?|(012|016)T[46])", + "INTEL SSDSC(1N|2B)[ABPX]((080|100|120|150|160|200|240|300|400|480|600|800)[GH][3467][CERT]?|(012|016)T[46])|" // A = S3700, B*4 = S3500, B*6 = S3510, P = 730, X = S3610 // Dell ships drives with model of the form SSDSC2BB120G4R + "VK000(120|240|480)GWSXF", // tested with VK000480GWSXF/HPG2 (HPE INTEL SSDSC2BB480G4) "", "", //"-v 3,raw16(avg16),Spin_Up_Time " //"-v 4,raw48,Start_Stop_Count " //"-v 5,raw16(raw16),Reallocated_Sector_Ct " //"-v 9,raw24(raw8),Power_On_Hours " + "-v 11,raw48,Unknown_Intel_Attribute " // VK000480GWSXF //"-v 12,raw48,Power_Cycle_Count " "-v 170,raw48,Available_Reservd_Space " "-v 171,raw48,Program_Fail_Count " "-v 172,raw48,Erase_Fail_Count " + "-v 173,raw48,Unknown_Intel_Attribute " // VK000480GWSXF "-v 174,raw48,Unsafe_Shutdown_Count " "-v 175,raw16(raw16),Power_Loss_Cap_Test " "-v 183,raw48,SATA_Downshift_Count " @@ -1877,7 +1890,8 @@ const drive_settings builtin_knowndrives[] = { // Samsung SSD 860 EVO 250GB/RVT01B6Q, Samsung SSD 860 EVO mSATA 250GB/RVT41B6Q, // Samsung SSD 860 EVO 500GB/RVT01B6Q, Samsung SSD 860 EVO mSATA 500GB/RVT41B6Q, // Samsung SSD 860 EVO mSATA 1TB/RVT41B6Q, Samsung SSD 860 EVO 2TB/RVT01B6Q, - // Samsung SSD 860 EVO 4TB/RVT04B6Q, Samsung SSD 870 EVO 1TB/SVT01B6Q + // Samsung SSD 860 EVO 4TB/RVT04B6Q, Samsung SSD 870 EVO 1TB/SVT01B6Q, + // Samsung SSD 870 EVO 4TB/SVT02B6Q "Samsung SSD 8[56]0 PRO ((128|256|512)G|[124]T)B|" // tested with Samsung SSD 850 PRO 128GB/EXM01B6Q, // Samsung SSD 850 PRO 1TB/EXM01B6Q, Samsung SSD 850 PRO 2TB/EXM02B6Q, // Samsung SSD 860 PRO 256GB/RVM01B6Q, Samsung SSD 860 PRO 512GB/RVM01B6Q, @@ -1913,6 +1927,7 @@ const drive_settings builtin_knowndrives[] = { "SAMSUNG MZ7L3(240|480|960|1T9|3T8|7T6)H(B[LN][AT]|CHQ|CJR)-.*|" // PM893/897, tested with // SAMSUNG MZ7L3240HCHQ-00A07/JXTC104Q, SAMSUNG MZ7L3480HCHQ-00A07/JXTC104Q, // SAMSUNG MZ7L3480HBLT-00A07/JXTE004Q, SAMSUNG MZ7L33T8HBLT-00A07/JXTC104Q + "MK000(240|480|960)GZXRB|" // MK000960GZXRB/HPG0 (HPE MZ7L3960HBLT-00AH3) "SAMSUNG MZ7KH(240|480|960|1T9|3T8)HA(HQ|JR|LS)-.*|" //SM883 "SAMSUNG MZ[7N](LF|TY)(128|192|256)H[CD](GS|HP)-.*|" // CM871/871a, tested with SAMSUNG MZNLF128HCHP-000H1/FXT21H1Q, // SAMSUNG MZNTY256HDHP-000/MAT21K0Q, SAMSUNG MZ7LF192HCGS-000L1/FXT03L1Q @@ -1969,7 +1984,8 @@ const drive_settings builtin_knowndrives[] = { "-v 247,raw48,Timed_Workld_Timer " // PM863, PM893 "-v 249,raw48,NAND_Writes_1GiB " // CM871a, PM871 "-v 250,raw48,SATA_Iface_Downshift " // from the spec - "-v 251,raw48,NAND_Writes" // PM863, PM893 + "-v 251,raw48,NAND_Writes " // PM863, PM893 + "-v 252,raw48,Added_Bad_Flash_Blk_Ct" // 870 EVO FW SVT02B6Q }, { "Marvell based SanDisk SSDs", "SanDisk SD5SG2[0-9]*G1052E|" // X100 (88SS9174), tested with SanDisk SD5SG2256G1052E/10.04.01 @@ -2110,9 +2126,10 @@ const drive_settings builtin_knowndrives[] = { }, { "Silicon Motion based SSDs", "ADATA_IMSS332-((008|016|032|064|128|256|512)G|001T)[AEMT]P?|" // tested with ADATA_IMSS332-128GTP/Q0810B - "ADATA (SP550|SU(650(NS38)?|655|[89]00))|" // tested with ADATA SP550/O0803B5a, ADATA SU650/S0212B0, - // ADATA SU650/V8X01c45, ADATA SU650/V8X21c64, ADATA SU650NS38/P191202a, ADATA SU655/V8X01c55, - // ADATA SU800/Q0913A, ADATA SU800/R0427A, ADATA SU800/R0918B, ADATA SU900/Q0125A, ADATA SU900/Q0710B + "ADATA (SP550|SU(630|650(NS38)?|655|[89]00))|" // tested with ADATA SP550/O0803B5a, ADATA SU630/S1127B0, + // ADATA SU650/S0212B0, ADATA SU650/V8X01c45, ADATA SU650/V8X21c64, ADATA SU650NS38/P191202a, + // ADATA SU655/V8X01c55, ADATA SU800/Q0913A, ADATA SU800/R0427A, ADATA SU800/R0918B, ADATA SU900/Q0125A, + // ADATA SU900/Q0710B "CORSAIR FORCE LX SSD|" // tested with CORSAIR FORCE LX SSD/N0307A "CHN mSATAM3 (128|256|512)|" // Zheino M3, tested with CHN mSATAM3 128/Q1124A0 "CIS 2S M305 (16|32|64|128|256)GB|" // Ceroz M305, tested with CIS 2S M305 64GB/P0316B @@ -2129,14 +2146,18 @@ const drive_settings builtin_knowndrives[] = { "KingSpec KSD-[PS]A25\\.[1-9]-(016|032|064|128)(MS|SJ)|" // tested with KingSpec KSD-PA25.6-064MS/20140803 "KINGSTON SKC600(MS)?(256|512|1024|2048)G|" // KC600 MS=mSATA, tested with KINGSTON SKC600256G/S4500105, // KINGSTON SKC600MS256G/S4500107 - "LITEON LMH-(128|256|512)V2M-.*|" // tested with LITEON LMH-256V2M-11 MSATA 256GB/FM8110C - "LITEON LCH-(128|256V|512)2S-.*|" // tested with LITEON LCH-256V2S-HP/2C02 - "MKNSSDRE(1TB|2TB|512GB|500GB|256GB|250GB)|" // tested with MKNSSDRE256GB/N1007C + "LITEON L[CM]H-(128|256|512)V2[MS](-.*)?|" // tested with LITEON LCH-256V2S-HP/2C02, + // LITEON LCH-256V2S/3C87901, LITEON LMH-256V2M-11 MSATA 256GB/FM8110C + "MKNSSDRE((25[06]|500|512)G|[12]T)B(-LT)?|" // Mushkin, tested with MKNSSDRE256GB/N1007C, + // MKNSSDRE250GB-LT/O1026A "MKNSSD(S2|TR)(12[08]|2[45]0|480|500)GB(-(3DL|LT))?|" // Mushkin, tested with MKNSSDS2500GB/T0818A0, // MKNSSDTR500GB/O1126A, MKNSSDTR128GB-3DL/Q0616B0 - "NFN025SA31T-.*|"// Neo Forza (?), from HP Laptop, tested with NFN025SA31T-6000000/S0628A0 + "NFN025SA31T-.*|" // Neo Forza (?), from HP Laptop, tested with NFN025SA31T-6000000/S0628A0 + "NFORCE (256|512)25 - SSZS13|" // Nextron NForce, tested with NFORCE 25625 - SSZS13/V0915A0 + "ONDA S-12 64GB|" // tested with ONDA S-12 64GB/U0401A0 "OWC Envoy Pro|" // tested with OWC Envoy Pro/R0522A0 (0x1e91:0xa2a5) - "Patriot P200 ((128|256|512)GB|[12]TB)|" // tested with Patriot P200 256GB/S1022A0 + "Patriot P2[01]0 ((128|256|512)GB|[12]TB)|" // tested with Patriot P200 256GB/S1022A0, + // Patriot P210 256GB/HPS2227P "R3SL(120|240|480|960)G|" // AMD Radeon SSDs, tested with R3SL240G/P0422C "Ramsta SSD S800 (120|240|480)GB|" // SM2258G, tested with Ramsta SSD S800 480GB/RS81V0 "SED2QII-LP SATA SSD ((64|128|256|512)GB|[12]TB)|" // ACPI SED2QII-LP, tested with @@ -2238,24 +2259,26 @@ const drive_settings builtin_knowndrives[] = { "240GB|" // from Lenovo T430 Thinkpad, tested with 240GB/P0510E "Dogfish SSD (128|256|512)GB|" // tested with Dogfish SSD 128GB/S1211A0 "GIM(16|32|64|128|256|512)|"// GUDGA GIM, tested with GIM128/U0401A0 - "INTENSO|" // tested with INTENSO/S1211A0 (Portable SSD 256GB premium edition) - "Intenso SSD|" // tested with Intenso SSD/Q1107A0 - "Intenso ?SSD Sata III|" // Sata III High, tested with Intenso SSD Sata III/P0510E, - // Intenso SSD Sata III/R0817B0 + "INTENSO( SSD)?|" // tested with INTENSO/S1211A0 (Portable SSD 256GB premium edition), + // INTENSO/V0609A0, INTENSO SSD/V0823A0 + "Intenso ?SSD( Sata III)?|" // tested with Intenso SSD/Q1107A0, Intenso SSD Sata III/P0510E, + // Intenso SSD Sata III/R0817B0, Intenso SSD Sata III/V0303B0 "KingFast|" // tested with KingFast/P0725A (F6M), KingFast/S0424A0 (120GB), KingFast/S1128B0 (512GB) "KSM512|" // KingSpec, tested with KSM512/S0509A0 "LDLC|" // tested with LDLC/KFS03005 + "Netac MobileDataStar|" // tested with Netac MobileDataStar/HPS2227I (0x0dd8:0x0562) "ORTIAL SSD|" // tested with ORTIAL SSD/U0202A0 (128GB) "RX7 (240|256|512)G|" // tested with RX7 240G/T0910A0 "SATA3 ((12[08]|240|256|480)G|[12]T)B SSD|" // TCSUNBOW X3, tested with SATA3 240GB SSD/S0618A0, // SATA3 1TB SSD/S1230A0, // KingDian S370, tested with SATA3 128GB SSD/T0311A0, SATA3 256GB SSD/S1127B0 // KingDian S280, tested with SATA3 240GB SSD/T0519A0 - "SPCC M\\.2 SSD|" // Silicon Power 2280 M55, tested with SPCC M.2 SSD/Q0627A0 + "SPCC M\\.2 SSD|" // Silicon Power A/M55, tested with SPCC M.2 SSD/Q0627A0, SPCC M.2 SSD/U0506A0 "T-FORCE (128|256|512)GB|" // tested with T-FORCE 512GB/T0910A0 "Verbatim Vi550 S3", // may also exist with different controller (tickets #1626 <> #1629), - // tested with Verbatim Vi550 S3/U1124A0 (256GB) - "KFS03005|P0510E|P0725A|Q(0627|1107)A0|R0817B0|S(0424|0509|0618|1211|1230)A0|S112[78]B0|T0(311|519|910)A0|U(0202|0401|1124)A0", + // tested with Verbatim Vi550 S3/U1124A0 (128GB) + "HPS2227I|KFS03005|P0510E|P0725A|Q(0627|1107)A0|R0817B0|S(0424|0509|0618|1211|1230)A0|" + "S112[78]B0|T0(311|519|910)A0|U(0202|0401|0506|1124)A0|V0((606|823)A|303B)0", "", "-v 148,raw48,Total_SLC_Erase_Ct " "-v 149,raw48,Max_SLC_Erase_Ct " @@ -2916,6 +2939,7 @@ const drive_settings builtin_knowndrives[] = { "SK ?hynix (SC(210|300|308|311|313|401)|SH920) .*|" // tested with // SK hynix SC210 mSATA 256GB/20002L00, // SKhynix SC300 HFS256G32MND-3210A/20131P00, + // SK hynix SC308 SATA 256GB/30000P10, // SK hynix SC308 SATA 128GB/30001P10, // SK hynix SC311 SATA 512GB/70000P10, // SK hynix SC313 HFS256G32TNF-N3A0A/70000P10, @@ -2928,7 +2952,6 @@ const drive_settings builtin_knowndrives[] = { // HFS512G39MND-3510A/20400P00 "HFS(128|256|512)G39TND-N210A|" // SC308, tested with HFS128G39TND-N210A/30001P10 "HFS(120|250|500)G32TND-N1A2A|" // SL308, tested with HFS500G32TND-N1A2A/30000P10 - "HFS(128|256|512)G39TND-N210A|" // SC308, tested with HFS128G39TND-N210A/30001P10 "HFS(128|256|512)G32TNF-N3A0A|" // SC313, tested with HFS256G32TNF-N3A0A/70000P10 "SHGS31-(250|500|1000)GS-2", // S31, tested with SHGS31-1000GS-2/90000Q00 "", "", @@ -2966,12 +2989,12 @@ const drive_settings builtin_knowndrives[] = { "-v 212,raw48,Phy_Error_Count " "-v 231,raw48,SSD_Life_Left " "-v 234,raw48,Unknown_SK_hynix_Attrib " - "-v 236,raw48,Unknown_SK_hynix_Attrib " // SC313 + "-v 236,raw48,Unknown_SK_hynix_Attrib " // SC311, SC313 "-v 238,raw48,Unknown_SK_hynix_Attrib " // SC401 "-v 241,raw48,Total_Writes_GB " // SC31: ~GB, not GiB (#1517) "-v 242,raw48,Total_Reads_GB " "-v 243,raw48,Total_Media_Writes " - "-v 249,raw48,Unknown_SK_hynix_Attrib " // SC313 + "-v 249,raw48,NAND_Writes_GiB " // SC311, SC313 "-v 250,raw48,Read_Retry_Count " }, { "SK hynix SATA SSDs", @@ -5274,8 +5297,8 @@ const drive_settings builtin_knowndrives[] = { "-d usbjmicron" }, { "USB: Samsung Portable SSD T7; ASMedia ASM2362", - "0x04e8:0x4001", - "", + "0x04e8:0x(4001|61fb)", // 0x61fb: T7 Shield + "", // 0x0100 "", "-d sntasmedia" }, @@ -5878,6 +5901,13 @@ const drive_settings builtin_knowndrives[] = { "", "-d sat" }, + // Netac Technology + { "USB: Netac Z Slim; ", + "0x0dd8:0x0562", + "", // 0x1101 + "", + "-d sat" + }, // Cowon Systems, Inc. { "USB: Cowon iAudio X5; ", "0x0e21:0x0510", @@ -6149,8 +6179,8 @@ const drive_settings builtin_knowndrives[] = { "-d sat" }, // ASMedia - { "USB: ; ASMedia ASM2362", // USB->PCIe (NVMe) - "0x174c:0x2362", + { "USB: ; ASMedia ASM236x", // USB->PCIe (NVMe) + "0x174c:0x236[24]", "", "", "-d sntasmedia" @@ -6161,6 +6191,13 @@ const drive_settings builtin_knowndrives[] = { "", "-d sat" }, + // ASMedia + { "USB: ; ASMedia ASM1352-PM", // USB3->2xSATA + "0x174d:0x1352", + "", // 0x0100 + "", + "-d sat" + }, // LucidPort { "USB: ; LucidPORT USB300", // RaidSonic ICY BOX IB-110StU3-B, Sharkoon SATA QuickPort H3 "0x1759:0x500[02]", // 0x5000: USB 2.0, 0x5002: USB 3.0 @@ -6410,6 +6447,13 @@ const drive_settings builtin_knowndrives[] = { "", "-d sat" }, + // Other World Computing + { "USB: USB3 to SATA; ", + "0x7825:0xa2a4", + "", // 0x4101 + "", + "-d sat" + }, // JMicron II { "USB: ; JMicron JMS566", "0xa152:0xb566", @@ -6417,6 +6461,13 @@ const drive_settings builtin_knowndrives[] = { "", "-d sat" }, + // 0xab12 (?) + { "USB: ; JMicron JMS578", + "0xab12:0x34cd", + "", // 0x0405 + "", + "-d sat" + }, // Logilink { "USB: ; ", "0xabcd:0x610[34]", // 0x6103: LogiLink AU0028A V1.0 USB 3.0 to IDE & SATA Adapter diff --git a/smartmontools-7.4-r5121.patch b/smartmontools-7.4-r5121.patch new file mode 100644 index 0000000..4a098e6 --- /dev/null +++ b/smartmontools-7.4-r5121.patch @@ -0,0 +1,200 @@ +diff -up smartmontools-7.1/nvmecmds.cpp.r5121 smartmontools-7.1/nvmecmds.cpp +--- smartmontools-7.1/nvmecmds.cpp.r5121 2019-07-01 22:54:14.000000000 +0200 ++++ smartmontools-7.1/nvmecmds.cpp 2023-11-22 12:56:02.927324622 +0100 +@@ -3,7 +3,7 @@ + * + * Home page of code is: https://www.smartmontools.org + * +- * Copyright (C) 2016-19 Christian Franke ++ * Copyright (C) 2016-20 Christian Franke + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +@@ -132,6 +132,7 @@ bool nvme_read_id_ctrl(nvme_device * dev + swapx(&id_ctrl.vid); + swapx(&id_ctrl.ssvid); + swapx(&id_ctrl.cntlid); ++ swapx(&id_ctrl.ver); + swapx(&id_ctrl.oacs); + swapx(&id_ctrl.wctemp); + swapx(&id_ctrl.cctemp); +@@ -181,30 +182,54 @@ bool nvme_read_id_ns(nvme_device * devic + return true; + } + +-// Read NVMe log page with identifier LID. +-bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, +- unsigned size, bool broadcast_nsid) ++static bool nvme_read_log_page_1(nvme_device * device, unsigned nsid, ++ unsigned char lid, void * data, unsigned size, unsigned offset = 0) + { +- if (!(4 <= size && size <= 0x4000 && (size % 4) == 0)) +- throw std::logic_error("nvme_read_log_page(): invalid size"); ++ if (!(4 <= size && size <= 0x1000 && !(size % 4) && !(offset % 4))) ++ return device->set_err(EINVAL, "Invalid NVMe log size %u or offset %u", size, offset); + + memset(data, 0, size); + nvme_cmd_in in; + in.set_data_in(nvme_admin_get_log_page, data, size); +- in.nsid = broadcast_nsid ? 0xffffffff : device->get_nsid(); ++ in.nsid = nsid; + in.cdw10 = lid | (((size / 4) - 1) << 16); ++ in.cdw12 = offset; // LPOL, NVMe 1.2.1 + + return nvme_pass_through(device, in); + } + ++// Read NVMe log page with identifier LID. ++unsigned nvme_read_log_page(nvme_device * device, unsigned nsid, unsigned char lid, ++ void * data, unsigned size, bool nvme_121, unsigned offset /* = 0 */) ++{ ++ unsigned n, bs; ++ for (n = 0; n < size; n += bs) { ++ if (!nvme_121 && offset + n > 0) { ++ device->set_err(ENOSYS, "Log Page Offset requires NVMe >= 1.2.1"); ++ break; ++ } ++ ++ // Limit transfer size to one page to avoid problems with ++ // limits of NVMe pass-through layer or too low MDTS values. ++ bs = size - n; ++ if (bs > 0x1000) ++ bs = 0x1000; ++ if (!nvme_read_log_page_1(device, nsid, lid, (char *)data + n, bs, offset + n)) ++ break; ++ } ++ ++ return n; ++} ++ + // Read NVMe Error Information Log. +-bool nvme_read_error_log(nvme_device * device, nvme_error_log_page * error_log, unsigned num_entries) ++unsigned nvme_read_error_log(nvme_device * device, nvme_error_log_page * error_log, ++ unsigned num_entries, bool nvme_121) + { +- if (!nvme_read_log_page(device, 0x01, error_log, num_entries * sizeof(*error_log), true)) +- return false; ++ unsigned n = nvme_read_log_page(device, 0xffffffff, 0x01, error_log, ++ num_entries * sizeof(*error_log), nvme_121); + + if (isbigendian()) { +- for (unsigned i = 0; i < num_entries; i++) { ++ for (unsigned i = 0; i < n; i++) { + swapx(&error_log[i].error_count); + swapx(&error_log[i].sqid); + swapx(&error_log[i].cmdid); +@@ -215,13 +240,13 @@ bool nvme_read_error_log(nvme_device * d + } + } + +- return true; ++ return n / sizeof(*error_log); + } + + // Read NVMe SMART/Health Information log. + bool nvme_read_smart_log(nvme_device * device, nvme_smart_log & smart_log) + { +- if (!nvme_read_log_page(device, 0x02, &smart_log, sizeof(smart_log), true)) ++ if (!nvme_read_log_page_1(device, 0xffffffff, 0x02, &smart_log, sizeof(smart_log))) + return false; + + if (isbigendian()) { +diff -up smartmontools-7.1/nvmecmds.h.r5121 smartmontools-7.1/nvmecmds.h +--- smartmontools-7.1/nvmecmds.h.r5121 2019-07-01 22:54:14.000000000 +0200 ++++ smartmontools-7.1/nvmecmds.h 2023-11-22 12:56:02.927324622 +0100 +@@ -3,7 +3,7 @@ + * + * Home page of code is: https://www.smartmontools.org + * +- * Copyright (C) 2016-19 Christian Franke ++ * Copyright (C) 2016-20 Christian Franke + * + * Original code from : + * Copyright (C) 2011-2014 Intel Corporation +@@ -236,12 +236,12 @@ bool nvme_read_id_ctrl(nvme_device * dev + bool nvme_read_id_ns(nvme_device * device, unsigned nsid, smartmontools::nvme_id_ns & id_ns); + + // Read NVMe log page with identifier LID. +-bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, +- unsigned size, bool broadcast_nsid); ++unsigned nvme_read_log_page(nvme_device * device, unsigned nsid, unsigned char lid, ++ void * data, unsigned size, bool nvme_121, unsigned offset = 0); + + // Read NVMe Error Information Log. +-bool nvme_read_error_log(nvme_device * device, smartmontools::nvme_error_log_page * error_log, +- unsigned num_entries); ++unsigned nvme_read_error_log(nvme_device * device, smartmontools::nvme_error_log_page * error_log, ++ unsigned num_entries, bool nvme_121); + + // Read NVMe SMART/Health Information log. + bool nvme_read_smart_log(nvme_device * device, smartmontools::nvme_smart_log & smart_log); +diff -up smartmontools-7.1/nvmeprint.cpp.r5121 smartmontools-7.1/nvmeprint.cpp +--- smartmontools-7.1/nvmeprint.cpp.r5121 2023-11-22 12:56:02.927324622 +0100 ++++ smartmontools-7.1/nvmeprint.cpp 2023-11-22 13:00:34.472659814 +0100 +@@ -524,6 +524,9 @@ int nvmePrintMain(nvme_device * device, + } + } + ++ // Log Page Offset requires NVMe >= 1.2.1 ++ bool nvme_121 = (id_ctrl.ver >= 0x10201); ++ + // Print Error Information Log + if (options.error_log_entries) { + unsigned num_entries = id_ctrl.elpe + 1; // 0-based value +@@ -531,39 +534,47 @@ int nvmePrintMain(nvme_device * device, + nvme_error_log_page * error_log = + reinterpret_cast(error_log_buf.data()); + +- if (!nvme_read_error_log(device, error_log, num_entries)) { ++ unsigned read_entries = nvme_read_error_log(device, error_log, num_entries, nvme_121); ++ if (!read_entries) { + jerr("Read Error Information Log failed: %s\n\n", device->get_errmsg()); + return retval | FAILSMART; + } ++ if (read_entries < num_entries) ++ jerr("Read Error Information Log failed, %u entries missing: %s\n", ++ num_entries - read_entries, device->get_errmsg()); + +- print_error_log(error_log, num_entries, options.error_log_entries); ++ print_error_log(error_log, read_entries, options.error_log_entries); + } + + // Dump log page + if (options.log_page_size) { + // Align size to dword boundary + unsigned size = ((options.log_page_size + 4-1) / 4) * 4; +- bool broadcast_nsid; + raw_buffer log_buf(size); + ++ unsigned nsid; + switch (options.log_page) { + case 1: + case 2: + case 3: +- broadcast_nsid = true; ++ nsid = 0xffffffff; + break; + default: +- broadcast_nsid = false; ++ nsid = device->get_nsid(); + break; + } +- if (!nvme_read_log_page(device, options.log_page, log_buf.data(), +- size, broadcast_nsid)) { ++ unsigned read_bytes = nvme_read_log_page(device, nsid, options.log_page, log_buf.data(), ++ size, nvme_121); ++ if (!read_bytes) { + jerr("Read NVMe Log 0x%02x failed: %s\n\n", options.log_page, device->get_errmsg()); + return retval | FAILSMART; + } ++ if (read_bytes < size) ++ jerr("Read NVMe Log 0x%02x failed, 0x%x bytes missing: %s\n", ++ options.log_page, size - read_bytes, device->get_errmsg()); + +- pout("NVMe Log 0x%02x (0x%04x bytes)\n", options.log_page, size); +- dStrHex(log_buf.data(), size, 0); ++ pout("NVMe Log 0x%02x (0x%04x bytes)\n", options.log_page, read_bytes); ++ dStrHex(log_buf.data(), read_bytes, 0); + pout("\n"); + } + diff --git a/smartmontools-7.4-r5471.patch b/smartmontools-7.4-r5471.patch new file mode 100644 index 0000000..ad38c76 --- /dev/null +++ b/smartmontools-7.4-r5471.patch @@ -0,0 +1,312 @@ +diff -up smartmontools-7.1/dev_interface.cpp.r5471 smartmontools-7.1/dev_interface.cpp +--- smartmontools-7.1/dev_interface.cpp.r5471 2019-11-24 19:19:24.000000000 +0100 ++++ smartmontools-7.1/dev_interface.cpp 2023-11-22 14:07:37.647756091 +0100 +@@ -15,6 +15,7 @@ + #include "dev_tunnelled.h" + #include "atacmds.h" // ATA_SMART_CMD/STATUS + #include "scsicmds.h" // scsi_cmnd_io ++#include "nvmecmds.h" // nvme_status_*() + #include "utility.h" + + #include +@@ -235,12 +236,11 @@ bool scsi_device::scsi_pass_through_and_ + + bool nvme_device::set_nvme_err(nvme_cmd_out & out, unsigned status, const char * msg /* = 0 */) + { +- if (!status) +- throw std::logic_error("nvme_device: set_nvme_err() called with status=0"); +- + out.status = status; + out.status_valid = true; +- return set_err(EIO, "%sNVMe Status 0x%02x", (msg ? msg : ""), status); ++ char buf[64]; ++ return set_err(nvme_status_to_errno(status), "%s%s (0x%03x)", (msg ? msg : ""), ++ nvme_status_to_info_str(buf, status), status); + } + + +diff -up smartmontools-7.1/nvmecmds.cpp.r5471 smartmontools-7.1/nvmecmds.cpp +--- smartmontools-7.1/nvmecmds.cpp.r5471 2023-11-22 14:07:37.646756079 +0100 ++++ smartmontools-7.1/nvmecmds.cpp 2023-11-22 14:07:37.648756102 +0100 +@@ -258,3 +258,221 @@ bool nvme_read_smart_log(nvme_device * d + + return true; + } ++ ++// Return flagged error message for NVMe status SCT/SC fields or nullptr if unknown. ++// If message starts with '-', the status indicates an invalid command (EINVAL). ++static const char * nvme_status_to_flagged_str(uint16_t status) ++{ ++ // Section 3.3.3.2.1 of NVM Express Base Specification Revision 2.0c, October 4, 2022 ++ uint8_t sc = (uint8_t)status; ++ switch ((status >> 8) & 0x7) { ++ case 0x0: // Generic Command Status ++ if (sc < 0x80) switch (sc) { ++ case 0x00: return "Successful Completion"; ++ case 0x01: return "-Invalid Command Opcode"; ++ case 0x02: return "-Invalid Field in Command"; ++ case 0x03: return "Command ID Conflict"; ++ case 0x04: return "Data Transfer Error"; ++ case 0x05: return "Commands Aborted due to Power Loss Notification"; ++ case 0x06: return "Internal Error"; ++ case 0x07: return "Command Abort Requested"; ++ case 0x08: return "Command Aborted due to SQ Deletion"; ++ case 0x09: return "Command Aborted due to Failed Fused Command"; ++ case 0x0a: return "Command Aborted due to Missing Fused Command"; ++ case 0x0b: return "-Invalid Namespace or Format"; ++ case 0x0c: return "Command Sequence Error"; ++ case 0x0d: return "-Invalid SGL Segment Descriptor"; ++ case 0x0e: return "-Invalid Number of SGL Descriptors"; ++ case 0x0f: return "-Data SGL Length Invalid"; ++ case 0x10: return "-Metadata SGL Length Invalid"; ++ case 0x11: return "-SGL Descriptor Type Invalid"; ++ case 0x12: return "-Invalid Use of Controller Memory Buffer"; ++ case 0x13: return "-PRP Offset Invalid"; ++ case 0x14: return "Atomic Write Unit Exceeded"; ++ case 0x15: return "Operation Denied"; ++ case 0x16: return "-SGL Offset Invalid"; ++ case 0x18: return "Host Identifier Inconsistent Format"; ++ case 0x19: return "Keep Alive Timer Expired"; ++ case 0x1a: return "-Keep Alive Timeout Invalid"; ++ case 0x1b: return "Command Aborted due to Preempt and Abort"; ++ case 0x1c: return "Sanitize Failed"; ++ case 0x1d: return "Sanitize In Progress"; ++ case 0x1e: return "SGL Data Block Granularity Invalid"; ++ case 0x1f: return "Command Not Supported for Queue in CMB"; ++ case 0x20: return "Namespace is Write Protected"; ++ case 0x21: return "Command Interrupted"; ++ case 0x22: return "Transient Transport Error"; ++ case 0x23: return "Command Prohibited by Command and Feature Lockdown"; ++ case 0x24: return "Admin Command Media Not Ready"; ++ // 0x25-0x7f: Reserved ++ } ++ else switch (sc) { ++ // 0x80-0xbf: I/O Command Set Specific ++ case 0x80: return "LBA Out of Range"; ++ case 0x81: return "Capacity Exceeded"; ++ case 0x82: return "Namespace Not Ready"; ++ case 0x83: return "Reservation Conflict"; ++ case 0x84: return "Format In Progress"; ++ case 0x85: return "-Invalid Value Size"; ++ case 0x86: return "-Invalid Key Size"; ++ case 0x87: return "KV Key Does Not Exist"; ++ case 0x88: return "Unrecovered Error"; ++ case 0x89: return "Key Exists"; ++ // 0x90-0xbf: Reserved ++ // 0xc0-0xff: Vendor Specific ++ } ++ break; ++ ++ case 0x1: // Command Specific Status ++ if (sc < 0x80) switch (sc) { ++ case 0x00: return "-Completion Queue Invalid"; ++ case 0x01: return "-Invalid Queue Identifier"; ++ case 0x02: return "-Invalid Queue Size"; ++ case 0x03: return "Abort Command Limit Exceeded"; ++ case 0x04: return "Abort Command Is Missing"; ++ case 0x05: return "Asynchronous Event Request Limit Exceeded"; ++ case 0x06: return "-Invalid Firmware Slot"; ++ case 0x07: return "-Invalid Firmware Image"; ++ case 0x08: return "-Invalid Interrupt Vector"; ++ case 0x09: return "-Invalid Log Page"; ++ case 0x0a: return "-Invalid Format"; ++ case 0x0b: return "Firmware Activation Requires Conventional Reset"; ++ case 0x0c: return "-Invalid Queue Deletion"; ++ case 0x0d: return "Feature Identifier Not Saveable"; ++ case 0x0e: return "Feature Not Changeable"; ++ case 0x0f: return "Feature Not Namespace Specific"; ++ case 0x10: return "Firmware Activation Requires NVM Subsystem Reset"; ++ case 0x11: return "Firmware Activation Requires Controller Level Reset"; ++ case 0x12: return "Firmware Activation Requires Maximum Time Violation"; ++ case 0x13: return "Firmware Activation Prohibited"; ++ case 0x14: return "Overlapping Range"; ++ case 0x15: return "Namespace Insufficient Capacity"; ++ case 0x16: return "-Namespace Identifier Unavailable"; ++ case 0x18: return "Namespace Already Attached"; ++ case 0x19: return "Namespace Is Private"; ++ case 0x1a: return "Namespace Not Attached"; ++ case 0x1b: return "Thin Provisioning Not Supported"; ++ case 0x1c: return "-Controller List Invalid"; ++ case 0x1d: return "Device Self-test In Progress"; ++ case 0x1e: return "Boot Partition Write Prohibited"; ++ case 0x1f: return "Invalid Controller Identifier"; ++ case 0x20: return "-Invalid Secondary Controller State"; ++ case 0x21: return "-Invalid Number of Controller Resources"; ++ case 0x22: return "-Invalid Resource Identifier"; ++ case 0x23: return "Sanitize Prohibited While Persistent Memory Region is Enabled"; ++ case 0x24: return "-ANA Group Identifier Invalid"; ++ case 0x25: return "ANA Attach Failed"; ++ case 0x26: return "Insufficient Capacity"; ++ case 0x27: return "Namespace Attachment Limit Exceeded"; ++ case 0x28: return "Prohibition of Command Execution Not Supported"; ++ case 0x29: return "I/O Command Set Not Supported"; ++ case 0x2a: return "I/O Command Set Not Enabled"; ++ case 0x2b: return "I/O Command Set Combination Rejected"; ++ case 0x2c: return "-Invalid I/O Command Set"; ++ case 0x2d: return "-Identifier Unavailable"; ++ // 0x2e-0x6f: Reserved ++ // 0x70-0x7f: Directive Specific ++ } ++ else if (sc < 0xb8) switch (sc) { ++ // 0x80-0xbf: I/O Command Set Specific (overlap with Fabrics Command Set) ++ case 0x80: return "-Conflicting Attributes"; ++ case 0x81: return "-Invalid Protection Information"; ++ case 0x82: return "Attempted Write to Read Only Range"; ++ case 0x83: return "Command Size Limit Exceeded"; ++ // 0x84-0xb7: Reserved ++ } ++ else switch (sc) { ++ case 0xb8: return "Zoned Boundary Error"; ++ case 0xb9: return "Zone Is Full"; ++ case 0xba: return "Zone Is Read Only"; ++ case 0xbb: return "Zone Is Offline"; ++ case 0xbc: return "Zone Invalid Write"; ++ case 0xbd: return "Too Many Active Zones"; ++ case 0xbe: return "Too Many Open Zones"; ++ case 0xbf: return "Invalid Zone State Transition"; ++ // 0xc0-0xff: Vendor Specific ++ } ++ break; ++ ++ case 0x2: // Media and Data Integrity Errors ++ switch (sc) { ++ // 0x00-0x7f: Reserved ++ case 0x80: return "Write Fault"; ++ case 0x81: return "Unrecovered Read Error"; ++ case 0x82: return "End-to-end Guard Check Error"; ++ case 0x83: return "End-to-end Application Tag Check Error"; ++ case 0x84: return "End-to-end Reference Tag Check Error"; ++ case 0x85: return "Compare Failure"; ++ case 0x86: return "Access Denied"; ++ case 0x87: return "Deallocated or Unwritten Logical Block"; ++ case 0x88: return "End-to-End Storage Tag Check Error"; ++ // 0x89-0xbf: Reserved ++ // 0xc0-0xff: Vendor Specific ++ } ++ break; ++ ++ case 0x3: // Path Related Status ++ switch (sc) { ++ case 0x00: return "Internal Path Error"; ++ case 0x01: return "Asymmetric Access Persistent Loss"; ++ case 0x02: return "Asymmetric Access Inaccessible"; ++ case 0x03: return "Asymmetric Access Transition"; ++ // 0x04-0x5f: Reserved ++ // 0x60-0x6f: Controller Detected Pathing Errors ++ case 0x60: return "Controller Pathing Error"; ++ // 0x61-0x6f: Reserved ++ // 0x70-0x7f: Host Detected Pathing Errors ++ case 0x70: return "Host Pathing Error"; ++ case 0x71: return "Command Aborted By Host"; ++ // 0x72-0x7f: Reserved ++ // 0x80-0xbf: I/O Command Set Specific ++ // 0xc0-0xff: Vendor Specific ++ } ++ break; ++ ++ // 0x4-0x6: Reserved ++ // 0x7: Vendor Specific ++ } ++ return nullptr; ++} ++ ++// Return errno for NVMe status SCT/SC fields: 0, EINVAL or EIO. ++int nvme_status_to_errno(uint16_t status) ++{ ++ if (!nvme_status_is_error(status)) ++ return 0; ++ const char * s = nvme_status_to_flagged_str(status); ++ if (s && *s == '-') ++ return EINVAL; ++ return EIO; ++} ++ ++// Return error message for NVMe status SCT/SC fields or nullptr if unknown. ++const char * nvme_status_to_str(uint16_t status) ++{ ++ const char * s = nvme_status_to_flagged_str(status); ++ return (s && *s == '-' ? s + 1 : s); ++} ++ ++// Return error message for NVMe status SCT/SC fields or explanatory message if unknown. ++const char * nvme_status_to_info_str(char * buf, size_t bufsize, uint16_t status) ++{ ++ const char * s = nvme_status_to_str(status); ++ if (s) ++ return s; ++ ++ uint8_t sct = (status >> 8) & 0x7, sc = (uint8_t)status; ++ const char * pfx = (sc >= 0xc0 ? "Vendor Specific " : "Unknown "); ++ switch (sct) { ++ case 0x0: s = "Generic Command Status"; break; ++ case 0x1: s = "Command Specific Status"; break; ++ case 0x2: s = "Media and Data Integrity Error"; break; ++ case 0x3: s = "Path Related Status"; break; ++ case 0x7: s = "Vendor Specific Status"; pfx = ""; break; ++ } ++ if (s) ++ snprintf(buf, bufsize, "%s%s 0x%02x", pfx, s, sc); ++ else ++ snprintf(buf, bufsize, "Unknown Status 0x%x/0x%02x", sct, sc); ++ return buf; ++} +diff -up smartmontools-7.1/nvmecmds.h.r5471 smartmontools-7.1/nvmecmds.h +--- smartmontools-7.1/nvmecmds.h.r5471 2023-11-22 14:07:37.646756079 +0100 ++++ smartmontools-7.1/nvmecmds.h 2023-11-22 14:09:29.911084240 +0100 +@@ -18,6 +18,8 @@ + + #include "static_assert.h" + ++#include ++#include + #include + + // The code below was originally imported from include file from +@@ -246,4 +248,22 @@ unsigned nvme_read_error_log(nvme_device + // Read NVMe SMART/Health Information log. + bool nvme_read_smart_log(nvme_device * device, smartmontools::nvme_smart_log & smart_log); + ++// Return true if NVMe status indicates an error. ++constexpr bool nvme_status_is_error(uint16_t status) ++ { return !!(status & 0x07ff); } ++ ++// Return errno for NVMe status SCT/SC fields: 0, EINVAL or EIO. ++int nvme_status_to_errno(uint16_t status); ++ ++// Return error message for NVMe status SCT/SC fields or nullptr if unknown. ++const char * nvme_status_to_str(uint16_t status); ++ ++// Return error message for NVMe status SCT/SC fields or explanatory message if unknown. ++const char * nvme_status_to_info_str(char * buf, size_t bufsize, uint16_t status); ++ ++// Version of above for fixed size buffers. ++template ++inline const char * nvme_status_to_info_str(char (& buf)[SIZE], unsigned status) ++ { return nvme_status_to_info_str(buf, SIZE, status); } ++ + #endif // NVMECMDS_H +diff -up smartmontools-7.1/nvmeprint.cpp.r5471 smartmontools-7.1/nvmeprint.cpp +--- smartmontools-7.1/nvmeprint.cpp.r5471 2023-11-22 14:07:37.648756102 +0100 ++++ smartmontools-7.1/nvmeprint.cpp 2023-11-22 14:11:35.899574762 +0100 +@@ -420,7 +420,7 @@ static void print_error_log(const nvme_e + continue; + + if (cnt == 1) +- pout("Num ErrCount SQId CmdId Status PELoc LBA NSID VS\n"); ++ pout("Num ErrCount SQId CmdId Status PELoc LBA NSID VS Message\n"); + + char sq[16] = "-", cm[16] = "-", st[16] = "-", pe[16] = "-"; + char lb[32] = "-", ns[16] = "-", vs[8] = "-"; +@@ -439,8 +439,10 @@ static void print_error_log(const nvme_e + if (e.vs != 0x00) + snprintf(vs, sizeof(vs), "0x%02x", e.vs); + +- pout("%3u %10" PRIu64 " %5s %7s %7s %6s %12s %5s %5s\n", +- i, e.error_count, sq, cm, st, pe, lb, ns, vs); ++ char buf[64]; ++ pout("%3u %10" PRIu64 " %5s %7s %7s %6s %12s %5s %5s %s\n", ++ i, e.error_count, sq, cm, st, pe, lb, ns, vs, ++ nvme_status_to_info_str(buf, e.status_field >> 1)); + } + + if (!cnt) diff --git a/smartmontools-7.4-r5472.patch b/smartmontools-7.4-r5472.patch new file mode 100644 index 0000000..eb6404e --- /dev/null +++ b/smartmontools-7.4-r5472.patch @@ -0,0 +1,159 @@ +diff -U0 smartmontools-7.1/ChangeLog.r5472 smartmontools-7.1/ChangeLog +diff -up smartmontools-7.1/smartd.conf.5.in.r5472 smartmontools-7.1/smartd.conf.5.in +--- smartmontools-7.1/smartd.conf.5.in.r5472 2019-12-13 21:20:45.000000000 +0100 ++++ smartmontools-7.1/smartd.conf.5.in 2023-11-22 12:32:37.341051288 +0100 +@@ -696,6 +696,20 @@ error log has increased since the last c + .I error + \- [NVMe] report if the "Number of Error Information Log Entries" from the + SMART/Health Information log has increased since the last check. ++.br ++[NEW EXPERIMENTAL SMARTD FEATURE] ++This will only be logged as LOG_CRIT if at least one of the new errors is ++still present in the Error Information log and its status indicates a ++device related error. ++Up to eight of the most recent of these errors are logged as LOG_INFO then. ++This is useful because the NVMe Error Information log is not persistent ++across power cycles or device resets. ++.br ++If all new errors are either no longer present in the log or are not device ++related (e.g. invalid command, invalid field in command, ...), a LOG_INFO ++message is generated instead. ++This avoids misleading warnings if the operating system issues unsupported ++commands and the device firmware also logs these kind of errors. + .Sp + .\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin + .I xerror +diff -up smartmontools-7.1/smartd.cpp.r5472 smartmontools-7.1/smartd.cpp +--- smartmontools-7.1/smartd.cpp.r5472 2019-12-29 14:10:18.000000000 +0100 ++++ smartmontools-7.1/smartd.cpp 2023-11-22 12:35:19.254046678 +0100 +@@ -2,7 +2,7 @@ + * Home page of code is: https://www.smartmontools.org + * + * Copyright (C) 2002-11 Bruce Allen +- * Copyright (C) 2008-19 Christian Franke ++ * Copyright (C) 2008-23 Christian Franke + * Copyright (C) 2000 Michael Cornwell + * Copyright (C) 2008 Oliver Bock + * +@@ -410,6 +410,9 @@ struct dev_config + + ata_vendor_attr_defs attribute_defs; // -v options + ++ // NVMe only ++ unsigned nvme_err_log_max_entries{}; // size of error log ++ + dev_config(); + }; + +@@ -2628,6 +2631,74 @@ static int nvme_get_max_temp_kelvin(cons + return k; + } + ++// Check the NVMe Error Information log for device related errors. ++static bool check_nvme_error_log(const dev_config & cfg, dev_state & state, nvme_device * nvmedev, ++ uint64_t newcnt = 0) ++{ ++ // Limit transfer size to one page (64 entries) to avoid problems with ++ // limits of NVMe pass-through layer or too low MDTS values. ++ unsigned want_entries = 64; ++ if (want_entries > cfg.nvme_err_log_max_entries) ++ want_entries = cfg.nvme_err_log_max_entries; ++ raw_buffer error_log_buf(want_entries * sizeof(nvme_error_log_page)); ++ nvme_error_log_page * error_log = ++ reinterpret_cast(error_log_buf.data()); ++ unsigned read_entries = nvme_read_error_log(nvmedev, error_log, want_entries, false /*!lpo_sup*/); ++ if (!read_entries) { ++ PrintOut(LOG_INFO, "Device: %s, Read %u entries from Error Information Log failed\n", ++ cfg.name.c_str(), want_entries); ++ return false; ++ } ++ ++ if (!newcnt) ++ return true; // Support check only ++ ++ // Scan log, find device related errors ++ uint64_t oldcnt = state.nvme_err_log_entries, mincnt = newcnt; ++ int err = 0, ign = 0; ++ for (unsigned i = 0; i < read_entries; i++) { ++ const nvme_error_log_page & e = error_log[i]; ++ if (!e.error_count) ++ continue; // unused ++ if (e.error_count <= oldcnt) ++ break; // stop on first old entry ++ if (e.error_count < mincnt) ++ mincnt = e.error_count; // min known error ++ if (e.error_count > newcnt) ++ newcnt = e.error_count; // adjust maximum ++ uint16_t status = e.status_field >> 1; ++ if (!nvme_status_is_error(status) || nvme_status_to_errno(status) == EINVAL) { ++ ign++; // Not a device related error ++ continue; ++ } ++ ++ // Log the most recent 8 errors ++ if (++err > 8) ++ continue; ++ char buf[64]; ++ PrintOut(LOG_INFO, "Device: %s, NVMe error [%u], count %" PRIu64 ", status 0x%04x: %s\n", ++ cfg.name.c_str(), i, e.error_count, e.status_field, ++ nvme_status_to_info_str(buf, e.status_field >> 1)); ++ } ++ ++ std::string msg = strprintf("Device: %s, NVMe error count increased from %" PRIu64 " to %" PRIu64 ++ " (%d new, %d ignored, %" PRIu64 " unknown)", ++ cfg.name.c_str(), oldcnt, newcnt, err, ign, ++ (mincnt > oldcnt + 1 ? mincnt - oldcnt - 1 : 0)); ++ // LOG_CRIT only if device related errors are found ++ if (!err) { ++ PrintOut(LOG_INFO, "%s\n", msg.c_str()); ++ } ++ else { ++ PrintOut(LOG_CRIT, "%s\n", msg.c_str()); ++ MailWarning(cfg, state, 4, "%s", msg.c_str()); ++ } ++ ++ state.nvme_err_log_entries = newcnt; ++ state.must_write = true; ++ return true; ++} ++ + static int NVMeDeviceScan(dev_config & cfg, dev_state & state, nvme_device * nvmedev, + const dev_config_vector * prev_cfgs) + { +@@ -2687,8 +2758,14 @@ static int NVMeDeviceScan(dev_config & c + } + + // Init total error count ++ cfg.nvme_err_log_max_entries = id_ctrl.elpe + 1; // 0's based value + if (cfg.errorlog || cfg.xerrorlog) { +- state.nvme_err_log_entries = le128_to_uint64(smart_log.num_err_log_entries); ++ if (!check_nvme_error_log(cfg, state, nvmedev)) { ++ PrintOut(LOG_INFO, "Device: %s, Error Information unavailable, ignoring -l [x]error\n", name); ++ cfg.errorlog = cfg.xerrorlog = false; ++ } ++ else ++ state.nvme_err_log_entries = le128_to_uint64(smart_log.num_err_log_entries); + } + + // If no supported tests selected, return +@@ -3760,16 +3837,12 @@ static int NVMeCheckDevice(const dev_con + + // Check if number of errors has increased + if (cfg.errorlog || cfg.xerrorlog) { +- uint64_t oldcnt = state.nvme_err_log_entries; + uint64_t newcnt = le128_to_uint64(smart_log.num_err_log_entries); +- if (newcnt > oldcnt) { +- PrintOut(LOG_CRIT, "Device: %s, number of Error Log entries increased from %" PRIu64 " to %" PRIu64 "\n", +- name, oldcnt, newcnt); +- MailWarning(cfg, state, 4, "Device: %s, number of Error Log entries increased from %" PRIu64 " to %" PRIu64, +- name, oldcnt, newcnt); +- state.must_write = true; ++ if (newcnt > state.nvme_err_log_entries) { ++ // Warn only if device related errors are found ++ check_nvme_error_log(cfg, state, nvmedev, newcnt); + } +- state.nvme_err_log_entries = newcnt; ++ // else // TODO: Handle decrease of count? + } + + CloseDevice(nvmedev, name); diff --git a/smartmontools.spec b/smartmontools.spec index 6b4da04..229efa8 100644 --- a/smartmontools.spec +++ b/smartmontools.spec @@ -1,7 +1,7 @@ Summary: Tools for monitoring SMART capable hard disks Name: smartmontools Version: 7.1 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 Group: System Environment/Base License: GPLv2+ @@ -20,6 +20,11 @@ Patch3: smartmontools-7.2-logsuppagefix2.patch Patch4: smartmontools-7.2-logsuppagefix3.patch Patch5: smartmontools-7.2-logsuppagefix4.patch +# 3x from upstream, for smartmontools <= 7.4, #RHEL-6982 +Patch6: smartmontools-7.4-r5121.patch +Patch7: smartmontools-7.4-r5471.patch +Patch8: smartmontools-7.4-r5472.patch + BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) #new rpm does not handle this (yet?) #Requires(triggerun): systemd-units @@ -40,11 +45,14 @@ failure. %prep %setup -q -%patch1 -p1 -b .defaultconf -%patch2 -p2 -b .logsuppagefix1 -%patch3 -p2 -b .logsuppagefix2 -%patch4 -p2 -b .logsuppagefix3 -%patch5 -p1 -b .logsuppagefix4 +%patch -P 1 -p1 -b .defaultconf +%patch -P 2 -p2 -b .logsuppagefix1 +%patch -P 3 -p2 -b .logsuppagefix2 +%patch -P 4 -p2 -b .logsuppagefix3 +%patch -P 5 -p1 -b .logsuppagefix4 +%patch -P 6 -p1 -b .r5121 +%patch -P 7 -p1 -b .r5471 +%patch -P 8 -p1 -b .r5472 # update SOURCE5 on maintainer's machine prior commiting, there's no internet connection on builders curl %{UrlSource5} -o %{SOURCE5} ||: @@ -116,6 +124,9 @@ fi %{_sharedstatedir}/%{name} %changelog +* Wed Nov 22 2023 Michal Hlavinka - 1:7.1-3 +- don't report new non-device related errors as critical (#RHEL-6982) + * Mon May 29 2023 Michal Hlavinka - 1:7.1-2 - support reporting of Error Counter logging details (#2136439)