Print this page
14019 Allow more control over zone init exit actions (fix mismerge)
14019 Allow more control over zone init exit actions
Portions contributed by: Joshua M. Clulow <jmc@joyent.com>
Portions contributed by: Andy Fiddaman <andy@omnios.org>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
Approved by: Robert Mustacchi <rm@fingolfin.org>
@@ -469,13 +469,13 @@
if (restart_init(what, why) == 0) {
return (B_TRUE);
}
}
-
/*
- * The restart failed, the zone will shut down.
+ * The restart failed, or the criteria for a restart are not met;
+ * the zone will shut down.
*/
z->zone_init_status = wstat(why, what);
(void) zone_kadmin(A_SHUTDOWN, AD_HALT, NULL, zone_kcred());
z->zone_proc_initpid = -1;
return (B_FALSE);
@@ -526,10 +526,17 @@
(void) task_cpu_time_incr(p->p_task, p->p_ttime);
p->p_ttime = 0;
}
mutex_exit(&p->p_lock);
+ /*
+ * Don't let init exit unless zone_start_init() failed its exec, or
+ * we are shutting down the zone or the machine.
+ *
+ * Since we are single threaded, we don't need to lock the
+ * following accesses to zone_proc_initpid.
+ */
if (p->p_pid == z->zone_proc_initpid) {
/* If zone's init restarts, we're done here. */
if (zone_init_exit(z, why, what))
return (0);
}