]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/blkdev: only pay attention to first 2 bits of smartctl return code 33421/head
authorSage Weil <sage@redhat.com>
Tue, 2 Jul 2019 19:37:40 +0000 (14:37 -0500)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Wed, 26 Feb 2020 01:39:17 +0000 (08:39 +0700)
Also make the error message a bit more informative.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit ef882d10a09310be31f6585efbdf3f87a779a9fd)

src/common/blkdev.cc

index dfe7b1ad3d0c2680ac6f58f283c67ce2d68cda65..39fabd406ef24c7e770aec5040a8b2bbd3c9ff92 100644 (file)
@@ -699,9 +699,17 @@ static int block_device_run_smartctl(const string& devname, int timeout,
   }
 
   int joinerr = smartctl.join();
-  if (joinerr) {
-    *result = std::string("smartctl returned an error (") + stringify(joinerr) +
-      "): stderr:\n") + smartctl.err() + "\nstdout:\n" + *result;
+  // Bit 0: Command line did not parse.
+  // Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode (see '-n' option above).
+  // Bit 2: Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above).
+  // Bit 3: SMART status check returned "DISK FAILING".
+  // Bit 4: We found prefail Attributes <= threshold.
+  // Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.
+  // Bit 6: The device error log contains records of errors.
+  // Bit 7: The device self-test log contains records of errors.  [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored.
+  if (joinerr & 3) {
+    *result = "smartctl returned an error ("s + stringify(joinerr) +
+      "): stderr:\n"s + smartctl.err() + "\nstdout:\n"s + *result;
     return -EINVAL;
   }