summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorStephen Hanson <Stephen.Hanson@Sun.COM>2010-08-06 12:31:49 -0700
committerStephen Hanson <Stephen.Hanson@Sun.COM>2010-08-06 12:31:49 -0700
commit35f59e50e9ef37e6f1bd3b018289d678d5551cab (patch)
tree4da323f1f4f1d180898f2da3ece473bfd13c70d4 /usr
parente0cb4e8d272cb359518fb7f8051ae590521e1035 (diff)
downloadillumos-gate-35f59e50e9ef37e6f1bd3b018289d678d5551cab.tar.gz
6969616 fmd automatically offline during hotplug event
6967430 apparent fmd live-lock in sensor-transport.so 6972021 fmd daemon got memory leaks by interrupt of calling interface fminject::fminject_fault_cpu 6972650 fmd_fmri_replace cause core when hc-list is absent
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd.c2
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd.h1
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd_scheme.c12
-rw-r--r--usr/src/cmd/fm/modules/common/eversholt/fme.c5
-rw-r--r--usr/src/cmd/fm/modules/common/eversholt/platform.c6
-rw-r--r--usr/src/cmd/fm/schemes/hc/scheme.c11
6 files changed, 28 insertions, 9 deletions
diff --git a/usr/src/cmd/fm/fmd/common/fmd.c b/usr/src/cmd/fm/fmd/common/fmd.c
index bdc86a3e7f..8177c81049 100644
--- a/usr/src/cmd/fm/fmd/common/fmd.c
+++ b/usr/src/cmd/fm/fmd/common/fmd.c
@@ -1001,6 +1001,8 @@ fmd_run(fmd_t *dp, int pfd)
(void) fmd_conf_getprop(dp->d_conf, "agent.path", &pap);
fmd_modhash_loadall(dp->d_mod_hash, pap, &fmd_proc_ops, NULL);
+ dp->d_loaded = 1; /* modules are now loaded */
+
/*
* With all modules loaded, replay fault events from the ASRU cache for
* any ASRUs that must be retired, replay error events from the errlog
diff --git a/usr/src/cmd/fm/fmd/common/fmd.h b/usr/src/cmd/fm/fmd/common/fmd.h
index c042f78c96..272fa3c305 100644
--- a/usr/src/cmd/fm/fmd/common/fmd.h
+++ b/usr/src/cmd/fm/fmd/common/fmd.h
@@ -67,6 +67,7 @@ typedef struct fmd {
pthread_key_t d_key; /* key for fmd's thread-specific data */
volatile int d_signal; /* signal indicating we should quit */
volatile int d_running; /* flag set when fmd_run() succeeds */
+ volatile int d_loaded; /* flag set when all modules loaded */
volatile int d_booted; /* flag set when fmd_run() completes */
uint_t d_fmd_debug; /* mask of fmd active debugging modes */
diff --git a/usr/src/cmd/fm/fmd/common/fmd_scheme.c b/usr/src/cmd/fm/fmd/common/fmd_scheme.c
index 5568dc8b9d..4ddad713a6 100644
--- a/usr/src/cmd/fm/fmd/common/fmd_scheme.c
+++ b/usr/src/cmd/fm/fmd/common/fmd_scheme.c
@@ -65,6 +65,9 @@ fmd_scheme_fmd_present(nvlist_t *nvl)
nvlist_lookup_string(nvl, FM_FMRI_FMD_VERSION, &version) != 0)
return (fmd_fmri_set_errno(EINVAL));
+ if (!fmd.d_loaded)
+ return (1);
+
if ((mp = fmd_modhash_lookup(fmd.d_mod_hash, name)) != NULL) {
rv = mp->mod_vers != NULL &&
strcmp(mp->mod_vers, version) == 0;
@@ -85,6 +88,9 @@ fmd_scheme_fmd_replaced(nvlist_t *nvl)
nvlist_lookup_string(nvl, FM_FMRI_FMD_VERSION, &version) != 0)
return (fmd_fmri_set_errno(EINVAL));
+ if (!fmd.d_loaded)
+ return (FMD_OBJ_STATE_UNKNOWN);
+
if ((mp = fmd_modhash_lookup(fmd.d_mod_hash, name)) != NULL) {
rv = mp->mod_vers != NULL &&
strcmp(mp->mod_vers, version) == 0;
@@ -104,6 +110,9 @@ fmd_scheme_fmd_service_state(nvlist_t *nvl)
if (nvlist_lookup_string(nvl, FM_FMRI_FMD_NAME, &name) != 0)
return (fmd_fmri_set_errno(EINVAL));
+ if (!fmd.d_loaded)
+ return (FMD_SERVICE_STATE_UNKNOWN);
+
if ((mp = fmd_modhash_lookup(fmd.d_mod_hash, name)) != NULL) {
rv = mp->mod_error != 0;
fmd_module_rele(mp);
@@ -122,6 +131,9 @@ fmd_scheme_fmd_unusable(nvlist_t *nvl)
if (nvlist_lookup_string(nvl, FM_FMRI_FMD_NAME, &name) != 0)
return (fmd_fmri_set_errno(EINVAL));
+ if (!fmd.d_loaded)
+ return (0);
+
if ((mp = fmd_modhash_lookup(fmd.d_mod_hash, name)) != NULL) {
rv = mp->mod_error != 0;
fmd_module_rele(mp);
diff --git a/usr/src/cmd/fm/modules/common/eversholt/fme.c b/usr/src/cmd/fm/modules/common/eversholt/fme.c
index 24ee852a4e..d6858c9916 100644
--- a/usr/src/cmd/fm/modules/common/eversholt/fme.c
+++ b/usr/src/cmd/fm/modules/common/eversholt/fme.c
@@ -386,7 +386,12 @@ newfme(const char *e0class, const struct ipath *e0ipp, fmd_hdl_t *hdl,
*/
init_size = alloc_total();
out(O_ALTFP|O_STAMP, "start config_snapshot using %d bytes", init_size);
+ nvlist_free(detector);
+ pathstr = ipath2str(NULL, e0ipp);
cfgdata = config_snapshot();
+ platform_units_translate(0, cfgdata->cooked, NULL, NULL,
+ &detector, pathstr);
+ FREE(pathstr);
platform_save_config(hdl, fmcase);
out(O_ALTFP|O_STAMP, "config_snapshot added %d bytes",
alloc_total() - init_size);
diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.c b/usr/src/cmd/fm/modules/common/eversholt/platform.c
index 72238b9da2..1fe49bd9b4 100644
--- a/usr/src/cmd/fm/modules/common/eversholt/platform.c
+++ b/usr/src/cmd/fm/modules/common/eversholt/platform.c
@@ -731,11 +731,7 @@ platform_config_snapshot(void)
lastgen = curgen;
/* we're getting a new config, so clean up the last one */
if (Lastcfg != NULL) {
- if (--Lastcfg->raw_refcnt == 0) {
- if (Lastcfg->begin != NULL)
- FREE(Lastcfg->begin);
- FREE(Lastcfg);
- }
+ config_free(Lastcfg);
}
Lastcfg = MALLOC(sizeof (struct cfgdata));
diff --git a/usr/src/cmd/fm/schemes/hc/scheme.c b/usr/src/cmd/fm/schemes/hc/scheme.c
index 38f250a266..ce290d8b6f 100644
--- a/usr/src/cmd/fm/schemes/hc/scheme.c
+++ b/usr/src/cmd/fm/schemes/hc/scheme.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <strings.h>
@@ -80,7 +79,9 @@ fmd_fmri_present(nvlist_t *nvl)
uint_t hcnprs;
err = nvlist_lookup_nvlist_array(nvl, FM_FMRI_HC_LIST, &hcprs, &hcnprs);
- err |= nvlist_lookup_string(hcprs[0], FM_FMRI_HC_NAME, &nm);
+ if (err != 0)
+ return (fmd_fmri_set_errno(EINVAL));
+ err = nvlist_lookup_string(hcprs[0], FM_FMRI_HC_NAME, &nm);
if (err != 0)
return (fmd_fmri_set_errno(EINVAL));
@@ -102,7 +103,9 @@ fmd_fmri_replaced(nvlist_t *nvl)
uint_t hcnprs;
err = nvlist_lookup_nvlist_array(nvl, FM_FMRI_HC_LIST, &hcprs, &hcnprs);
- err |= nvlist_lookup_string(hcprs[0], FM_FMRI_HC_NAME, &nm);
+ if (err != 0)
+ return (fmd_fmri_set_errno(EINVAL));
+ err = nvlist_lookup_string(hcprs[0], FM_FMRI_HC_NAME, &nm);
if (err != 0)
return (fmd_fmri_set_errno(EINVAL));