summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authoreota <none@none>2006-11-01 17:16:56 -0800
committereota <none@none>2006-11-01 17:16:56 -0800
commit44dc7d114800c45c22c623ec0ee6a468f2a5b11b (patch)
tree31f41ec76c3b0f47473dfab2128f1944968fda34 /usr/src
parent259d4401ef09013b381b479f0b1f0d90ed0fa863 (diff)
downloadillumos-joyent-44dc7d114800c45c22c623ec0ee6a468f2a5b11b.tar.gz
6484320 libsvm error causes md driver panic when jumpstarting snv_50 with a profile that includes SVM setup
6486178 mdattach failures can lead to panics when mddetach processing occurs
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/lvm/libsvm/common/metaconf.c8
-rw-r--r--usr/src/uts/common/io/lvm/md/md.c24
-rw-r--r--usr/src/uts/common/io/lvm/md/md_med.c13
3 files changed, 28 insertions, 17 deletions
diff --git a/usr/src/lib/lvm/libsvm/common/metaconf.c b/usr/src/lib/lvm/libsvm/common/metaconf.c
index 11bca39ed8..aed1fcd491 100644
--- a/usr/src/lib/lvm/libsvm/common/metaconf.c
+++ b/usr/src/lib/lvm/libsvm/common/metaconf.c
@@ -93,6 +93,9 @@ write_targ_nm_table(char *path)
while (fgets(buf, PATH_MAX, targfp) != NULL &&
(retval == RET_SUCCESS)) {
+ /* remove a new-line character for md_targ_nm_table */
+ if ((cp = strchr(buf, '\n')) != NULL)
+ *cp = 0;
/* cut off comments starting with '#' */
if ((cp = strchr(buf, '#')) != NULL)
*cp = 0;
@@ -103,9 +106,10 @@ write_targ_nm_table(char *path)
if (fprintf(mdfp, "md_targ_nm_table=\"%s\"", buf) < 0)
retval = RET_ERROR;
first_entry = 0;
+ } else {
+ if (fprintf(mdfp, ",\"%s\"", buf) < 0)
+ retval = RET_ERROR;
}
- if (fprintf(mdfp, ",\"%s\"", buf) < 0)
- retval = RET_ERROR;
}
if (!first_entry)
if (fprintf(mdfp, ";\n") < 0)
diff --git a/usr/src/uts/common/io/lvm/md/md.c b/usr/src/uts/common/io/lvm/md/md.c
index 973aef326a..e8b16b53d9 100644
--- a/usr/src/uts/common/io/lvm/md/md.c
+++ b/usr/src/uts/common/io/lvm/md/md.c
@@ -174,8 +174,8 @@ md_set_io_t md_set_io[MD_MAXSETS];
md_krwlock_t hsp_rwlp; /* protects hot_spare_interface */
md_krwlock_t ni_rwlp; /* protects notify_interface */
-md_ops_t **md_ops;
-ddi_modhandle_t *md_mods;
+md_ops_t **md_ops = NULL;
+ddi_modhandle_t *md_mods = NULL;
md_ops_t *md_opslist;
clock_t md_hz;
md_event_queue_t *md_event_queue = NULL;
@@ -460,6 +460,18 @@ mdattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
}
}
+ /*
+ * Must initialize the internal data structures before the
+ * any possible calls to 'goto attach_failure' as _fini
+ * routine references them.
+ */
+ med_init();
+
+ md_ops = (md_ops_t **)kmem_zalloc(
+ sizeof (md_ops_t *) * MD_NOPS, KM_SLEEP);
+ md_mods = (ddi_modhandle_t *)kmem_zalloc(
+ sizeof (ddi_modhandle_t) * MD_NOPS, KM_SLEEP);
+
/* try and get the md_xlate property */
/* Should we only do this if upgrade? */
len = sizeof (char) * 5;
@@ -541,12 +553,6 @@ mdattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
else
md_major_targ = 0;
- /* alloc md_ops and md_mods struct */
- md_ops = (md_ops_t **)kmem_zalloc(
- sizeof (md_ops_t *) * MD_NOPS, KM_SLEEP);
- md_mods = (ddi_modhandle_t *)kmem_zalloc(
- sizeof (ddi_modhandle_t) * MD_NOPS, KM_SLEEP);
-
/* allocate admin device node */
if (ddi_create_priv_minor_node(dip, "admin", S_IFCHR,
MD_ADM_MINOR, DDI_PSEUDO, 0, NULL, PRIV_SYS_CONFIG, 0640))
@@ -612,8 +618,6 @@ mdattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
}
}
- med_init();
-
MD_CLR_IN(IN_ATTACH);
return (DDI_SUCCESS);
diff --git a/usr/src/uts/common/io/lvm/md/md_med.c b/usr/src/uts/common/io/lvm/md/md_med.c
index 1bbfa4f86e..9cabdceb5e 100644
--- a/usr/src/uts/common/io/lvm/md/md_med.c
+++ b/usr/src/uts/common/io/lvm/md/md_med.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -255,6 +254,7 @@ struct med_client {
#define UAFLG_ERROR 0x00000002
#define UAFLG_RPCERROR 0x00000004
#define UAFLG_LOOPBACK 0x00000008
+#define UAFLG_LOCKINIT 0x00000010
/*
* most of this data is static. The mutex protects the changable items:
@@ -1535,6 +1535,7 @@ med_init(void)
}
mutex_init(&uap->ua_mutex, NULL, MUTEX_DEFAULT, NULL);
+ uap->ua_flags |= UAFLG_LOCKINIT;
bzero((caddr_t)&uap->ua_kn.knc_unused,
sizeof (uap->ua_kn.knc_unused));
}
@@ -1555,8 +1556,10 @@ med_fini(void)
for (uapi = 0; uapi < med_addr_tab_nents; uapi++) {
struct med_addr *uap = &med_addr_tab[uapi];
- if (! (uap->ua_flags & UAFLG_SKIP))
+ if (uap->ua_flags & UAFLG_LOCKINIT) {
mutex_destroy(&uap->ua_mutex);
+ uap->ua_flags &= ~UAFLG_LOCKINIT;
+ }
}
TRIVIA(("]\n"));