changeset 3671:48011e38989d

6500376 projdel from SUNWesu in SUNWCreq in s10/snv has missing dependency 6516822 Zone may shutdown without completing the final dance 6524250 panic: assertion failed: (*first)->vmb_start >= new_next->vmb_start, file: ../../common/vm/vm_usage.
author sl108498
date Fri, 16 Feb 2007 15:39:38 -0800
parents 6338278a5e69
children c5a5c46b417f
files usr/src/cmd/perl/contrib/Sun/Solaris/Project/Makefile.PL usr/src/cmd/perl/contrib/Sun/Solaris/Project/Project.xs usr/src/uts/common/os/zone.c usr/src/uts/common/vm/vm_usage.c
diffstat 4 files changed, 52 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/perl/contrib/Sun/Solaris/Project/Makefile.PL	Fri Feb 16 15:04:43 2007 -0800
+++ b/usr/src/cmd/perl/contrib/Sun/Solaris/Project/Makefile.PL	Fri Feb 16 15:39:38 2007 -0800
@@ -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 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #ident	"%Z%%M%	%I%	%E% SMI"
@@ -84,7 +83,7 @@
 WriteMakefile(
     NAME         => 'Sun::Solaris::Project',
     VERSION_FROM => 'Project.pm',
-    LIBS         => [ '-lproject -lpool -lgen' ],
+     LIBS         => '-lproject -lgen',
     @defines,
     @man3pods,
 );
--- a/usr/src/cmd/perl/contrib/Sun/Solaris/Project/Project.xs	Fri Feb 16 15:04:43 2007 -0800
+++ b/usr/src/cmd/perl/contrib/Sun/Solaris/Project/Project.xs	Fri Feb 16 15:39:38 2007 -0800
@@ -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 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Project.xs contains XS wrappers for the project database maniplulation
@@ -30,8 +29,10 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /* Solaris includes. */
+#include <zone.h>
 #include <project.h>
 #include <pool.h>
+#include <sys/pool_impl.h>
 #include <rctl.h>
 #include <stdio.h>
 
@@ -354,7 +355,32 @@
 PREINIT:
 	pool_conf_t *conf;
 	pool_t *pool;
+	pool_status_t status;
+	int fd;
 PPCODE:
+
+	/*
+	 * Determine if pools are enabled using /dev/pool directly, as
+	 * libpool may not be present.
+	 */
+	if (getzoneid() != GLOBAL_ZONEID) {
+		XSRETURN_IV(1);
+	}
+	if ((fd = open("/dev/pool", O_RDONLY)) < 0) {
+		XSRETURN_IV(1);
+	}
+	if (ioctl(fd, POOL_STATUSQ, &status) < 0) {
+		(void) close(fd);
+		XSRETURN_IV(1);
+	}
+	close(fd);
+	if (status.ps_io_state != 1) {
+		XSRETURN_IV(1);
+	}
+
+	/*
+	 * If pools are enabled, assume libpool is present.
+	 */
 	conf = pool_conf_alloc();
 	if (conf == NULL) {
 		XSRETURN_IV(1);
--- a/usr/src/uts/common/os/zone.c	Fri Feb 16 15:04:43 2007 -0800
+++ b/usr/src/uts/common/os/zone.c	Fri Feb 16 15:39:38 2007 -0800
@@ -3777,7 +3777,11 @@
 		return (set_errno(EINTR));
 	}
 
-	brand_unregister_zone(zone->zone_brand);
+	/*
+	 * Zone can be become down/destroyable even if the above wait
+	 * returns EINTR, so any code added here may never execute.
+	 * (i.e. don't add code here)
+	 */
 
 	zone_rele(zone);
 	return (0);
@@ -3875,9 +3879,12 @@
 
 	}
 
-	/* Get rid of the zone's kstats */
+	/* Get rid of the zone's kstats. */
 	zone_kstat_delete(zone);
 
+	/* Say goodbye to brand framework. */
+	brand_unregister_zone(zone->zone_brand);
+
 	/*
 	 * It is now safe to let the zone be recreated; remove it from the
 	 * lists.  The memory will not be freed until the last cred
--- a/usr/src/uts/common/vm/vm_usage.c	Fri Feb 16 15:04:43 2007 -0800
+++ b/usr/src/uts/common/vm/vm_usage.c	Fri Feb 16 15:39:38 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -773,9 +773,14 @@
 	next = *first;
 	new_next = new_first;
 
-	/* verify bounds span same pages */
-	ASSERT((*first)->vmb_start >= new_next->vmb_start);
-	ASSERT((*last)->vmb_end <= new_last->vmb_end);
+	/*
+	 * Verify first and last bound are covered by new bounds if they
+	 * have unknown type.
+	 */
+	ASSERT((*first)->vmb_type != VMUSAGE_BOUND_UNKNOWN ||
+	    (*first)->vmb_start >= new_next->vmb_start);
+	ASSERT((*last)->vmb_type != VMUSAGE_BOUND_UNKNOWN ||
+	    (*last)->vmb_end <= new_last->vmb_end);
 	for (;;) {
 		/* If bound already has type, proceed to next bound */
 		if (next->vmb_type != VMUSAGE_BOUND_UNKNOWN) {