Print this page
8074 need to add FMA event for SSD wearout

@@ -19,14 +19,13 @@
  * CDDL HEADER END
  */
 /*
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 /*
  * Disk status library
  *
  * This library is responsible for querying health and other status information
  * from disk drives.  It is intended to be a generic interface, however only

@@ -34,10 +33,11 @@
  * capable of detecting the following status conditions:
  *
  *      - Predictive failure
  *      - Overtemp
  *      - Self-test failure
+ *      - Solid State Media wearout
  */
 
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>

@@ -129,10 +129,11 @@
 {
         nvlist_free(dsp->ds_state);
         nvlist_free(dsp->ds_predfail);
         nvlist_free(dsp->ds_overtemp);
         nvlist_free(dsp->ds_testfail);
+        nvlist_free(dsp->ds_ssmwearout);
         if (dsp->ds_data)
                 dsp->ds_transport->dt_close(dsp->ds_data);
         (void) close(dsp->ds_fd);
         free(dsp->ds_path);
         free(dsp);

@@ -170,10 +171,12 @@
          * Scan (or rescan) the current device.
          */
         nvlist_free(dsp->ds_testfail);
         nvlist_free(dsp->ds_predfail);
         nvlist_free(dsp->ds_overtemp);
+        nvlist_free(dsp->ds_ssmwearout);
+        dsp->ds_ssmwearout = NULL;
         dsp->ds_testfail = dsp->ds_overtemp = dsp->ds_predfail = NULL;
         dsp->ds_faults = 0;
 
         /*
          * Even if there is an I/O failure when trying to scan the device, we

@@ -220,10 +223,19 @@
                     (dsp->ds_faults & DS_FAULT_OVERTEMP) != 0)) != 0 ||
                     (err = nvlist_add_nvlist(nvl, FM_EREPORT_SCSI_OVERTEMP,
                     dsp->ds_overtemp)) != 0)
                         goto nverror;
         }
+
+        if (dsp->ds_ssmwearout != NULL) {
+                if ((err = nvlist_add_boolean_value(faults,
+                    FM_EREPORT_SCSI_SSMWEAROUT,
+                    (dsp->ds_faults & DS_FAULT_SSMWEAROUT) != 0)) != 0 ||
+                    (err = nvlist_add_nvlist(nvl, FM_EREPORT_SCSI_SSMWEAROUT,
+                    dsp->ds_ssmwearout)) != 0)
+                        goto nverror;
+        }
 
         if ((err = nvlist_add_nvlist(nvl, "faults", faults)) != 0)
                 goto nverror;
 
         nvlist_free(faults);