changeset 2945:e0fa035619a8

6448006 4 node system paniced after adding some more disks to an existing metaset
author achimm
date Thu, 19 Oct 2006 14:29:42 -0700
parents 77169ac14224
children 2211d99f898b
files usr/src/uts/common/io/lvm/md/md_names.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/lvm/md/md_names.c	Wed Oct 18 08:18:18 2006 -0700
+++ b/usr/src/uts/common/io/lvm/md/md_names.c	Thu Oct 19 14:29:42 2006 -0700
@@ -2083,6 +2083,18 @@
 			} else {
 				min_devid_key = did_n->min_devid_key;
 				min_len = (size_t)did_n->min_namlen;
+				/*
+				 * Need to save the min_name as well because
+				 * if the alloc_entry() needs to expand the
+				 * record then it will free the existing
+				 * record (which will free any references
+				 * to information within it ie did_n->min_name)
+				 */
+				if (mname != NULL) {
+					kmem_free(mname, strlen(mname) + 1);
+				}
+				mname = kmem_alloc(min_len, KM_SLEEP);
+				(void) strcpy(mname, did_n->min_name);
 			}
 		} else {
 
@@ -2146,7 +2158,7 @@
 				cmn_err(CE_NOTE,
 				    "addname: failed to add to record");
 			}
-			(void) strcpy(new_did_n->min_name, did_n->min_name);
+			(void) strcpy(new_did_n->min_name, mname);
 			new_did_n->min_namlen = (ushort_t)min_len;
 		} else {