changeset 13220:fed843d791e9

349 hang during network boot (circular kcf dependency) Reviewed by: richlowe@richlowe.net Reviewed by: gwr@nexenta.com Reviewed by: bryancantrill@nexenta.com Approved by: gwr@nexenta.com
author Garrett D'Amore <garrett@nexenta.com>
date Tue, 19 Oct 2010 22:35:04 -0700
parents 233eeb988b49
children 879ee5195278
files usr/src/uts/common/crypto/api/kcf_random.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/crypto/api/kcf_random.c	Fri Oct 15 02:19:06 2010 -0400
+++ b/usr/src/uts/common/crypto/api/kcf_random.c	Tue Oct 19 22:35:04 2010 -0700
@@ -834,13 +834,22 @@
 	}
 }
 
+static void
+rnd_mechid(void *notused)
+{
+	_NOTE(ARGUNUSED(notused));
+	rngmech_type = crypto_mech2id(SUN_RANDOM);
+}
+
 void
 kcf_rnd_schedule_timeout(boolean_t do_mech2id)
 {
 	clock_t ut;	/* time in microseconds */
 
-	if (do_mech2id)
-		rngmech_type = crypto_mech2id(SUN_RANDOM);
+	if (do_mech2id) {
+		/* This should never fail due to TQ_SLEEP. */
+		(void) taskq_dispatch(system_taskq, rnd_mechid, NULL, TQ_SLEEP);
+	}
 
 	/*
 	 * The new timeout value is taken from the buffer of random bytes.