diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog index 624931548e2ef3b4b16811bcdbd30903fae5d6ac..53869aeb61c1821e538d3a928ef67d1d821b0fa3 100644 --- a/smartmontools/ChangeLog +++ b/smartmontools/ChangeLog @@ -1,5 +1,12 @@ $Id$ +2024-03-29 Christian Franke <franke@computer.org> + + nvmeprint.cpp: Fix self-test for single namespace devices. + Use broadcast NSID if only one namespace is supported + (#1741, GH issues/217). + smartctl.8.in: Document new behavior. + 2024-03-28 Christian Franke <franke@computer.org> drivedb.h: diff --git a/smartmontools/nvmeprint.cpp b/smartmontools/nvmeprint.cpp index dd5d49b184030403f9182080f7d8da8fc19d88f2..c8d373a6288f9aa10fd1eb2f5e0edc767ee26599 100644 --- a/smartmontools/nvmeprint.cpp +++ b/smartmontools/nvmeprint.cpp @@ -3,7 +3,7 @@ * * Home page of code is: https://www.smartmontools.org * - * Copyright (C) 2016-23 Christian Franke + * Copyright (C) 2016-24 Christian Franke * * SPDX-License-Identifier: GPL-2.0-or-later */ @@ -751,7 +751,12 @@ int nvmePrintMain(nvme_device * device, const nvme_print_options & options) // Check for self-test support bool self_test_sup = !!(id_ctrl.oacs & 0x0010); - unsigned self_test_nsid = device->get_nsid(); // TODO: Support NSID=0 to test controller + + // Use broadcast NSID for self-tests if only one namespace is supported. + // Some single namespace devices return failure if NSID=1 is used to + // address self-tests. + // TODO: Support NSID=0 to test controller + unsigned self_test_nsid = (id_ctrl.nn == 1 ? 0xffffffff : device->get_nsid()); // Read and print Self-test log, check for running test int self_test_completion = -1; diff --git a/smartmontools/smartctl.8.in b/smartmontools/smartctl.8.in index 398a5f74f8fb578d4fd56212f1352d57bfb4141f..8e35bd2b35622de754ad24a8ac94bb7a9fb47fe4 100644 --- a/smartmontools/smartctl.8.in +++ b/smartmontools/smartctl.8.in @@ -1,6 +1,6 @@ .ig Copyright (C) 2002-10 Bruce Allen -Copyright (C) 2004-23 Christian Franke +Copyright (C) 2004-24 Christian Franke SPDX-License-Identifier: GPL-2.0-or-later @@ -1477,6 +1477,13 @@ test terminology). .I selftest \- [NVMe: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE] prints the NVMe self-test log. +.br +[NEW EXPERIMENTAL SMARTCTL 7.5 FEATURE] +If the device does not support multiple namespaces, the broadcast namespace +is always used to read the self-test log and to start the tests (see +\*(Aq\-t TEST\*(Aq below). +This is because some single namespace devices return failure if namespace 1 +is used to address self-tests. .\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin .Sp .I xselftest[,NUM][,selftest]