6585441 spa_event_notify() doesn't pass its attributes
authoreschrock
Wed, 02 Jan 2008 14:11:28 -0800
changeset 5756 05eb4c1ff492
parent 5755 d860a06291b5
child 5757 7f9f16936b0d
6585441 spa_event_notify() doesn't pass its attributes 6646104 ZFS sysevent module segfaults on VDEV_CHECK sysevent 6646105 spa_check_removed() should not be called when doing SPA_LOAD_TRYIMPORT
usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c
usr/src/uts/common/fs/zfs/spa.c
--- a/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c	Sun Dec 30 02:13:22 2007 -0800
+++ b/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c	Wed Jan 02 14:11:28 2008 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -227,8 +227,7 @@
 	char *path;
 	uint_t c, children;
 	nvlist_t **child;
-	size_t len = strlen(dp->dd_compare);
-	uint64_t wholedisk = 0ULL;
+	size_t len;
 	uint64_t guid;
 
 	/*
@@ -241,14 +240,13 @@
 		return;
 	}
 
-	(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK,
-	    &wholedisk);
-
 	if (dp->dd_vdev_guid != 0) {
 		if (nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_GUID,
 		    &guid) != 0 || guid != dp->dd_vdev_guid)
 			return;
 	} else {
+		len = strlen(dp->dd_compare);
+
 		if (nvlist_lookup_string(nvl, dp->dd_prop, &path) != 0 ||
 		    strncmp(dp->dd_compare, path, len) != 0)
 			return;
--- a/usr/src/uts/common/fs/zfs/spa.c	Sun Dec 30 02:13:22 2007 -0800
+++ b/usr/src/uts/common/fs/zfs/spa.c	Wed Jan 02 14:11:28 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1334,7 +1334,7 @@
 	 * unopenable vdevs so that the normal autoreplace handler can take
 	 * over.
 	 */
-	if (autoreplace)
+	if (autoreplace && state != SPA_LOAD_TRYIMPORT)
 		spa_check_removed(spa->spa_root_vdev);
 
 	/*
@@ -4345,6 +4345,10 @@
 		}
 	}
 
+	if (sysevent_attach_attributes(ev, attr) != 0)
+		goto done;
+	attr = NULL;
+
 	(void) log_sysevent(ev, SE_SLEEP, &eid);
 
 done: