changeset 2744:0a6f00b6a209

6468554 zone install with a zfs zonepath could not create a dataset 6469902 BrandZ and GCC don't get along 6470348 Makefile race condition in usr/lib/brand/lx 6470764 zfs_clone() confuses filesystems and volumes
author nn35248
date Fri, 15 Sep 2006 11:26:15 -0700
parents 632c24f376ff
children 4634a7101488
files usr/src/Targetdirs usr/src/cmd/zoneadm/zfs.c usr/src/lib/brand/Makefile.brand usr/src/lib/brand/lx/cmd/Makefile usr/src/lib/brand/lx/librtld_db/Makefile usr/src/lib/brand/lx/librtld_db/amd64/Makefile usr/src/lib/brand/lx/librtld_db/i386/Makefile usr/src/lib/brand/lx/lx_brand/i386/lx_handler.s usr/src/lib/brand/lx/lx_nametoaddr/Makefile usr/src/lib/brand/lx/lx_nametoaddr/amd64/Makefile usr/src/lib/brand/lx/lx_nametoaddr/i386/Makefile usr/src/lib/brand/lx/lx_support/Makefile usr/src/lib/brand/lx/lx_support/lx_support.c usr/src/lib/brand/lx/lx_thunk/Makefile usr/src/lib/brand/lx/lx_thunk/amd64/Makefile usr/src/lib/brand/lx/lx_thunk/i386/Makefile usr/src/lib/brand/lx/netfiles/Makefile usr/src/lib/brand/lx/zone/Makefile usr/src/lib/brand/lx/zone/distros/Makefile usr/src/lib/brand/native/zone/Makefile usr/src/lib/brand/sn1/zone/Makefile usr/src/lib/libzfs/common/libzfs_dataset.c usr/src/uts/i86pc/ml/syscall_asm.s
diffstat 23 files changed, 49 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/Targetdirs	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/Targetdirs	Fri Sep 15 11:26:15 2006 -0700
@@ -171,7 +171,10 @@
 	/usr/lib/inet/wanboot
 # EXPORT DELETE END
 
-i386_ROOT.BIN=
+i386_ROOT.BIN= \
+	/usr/lib/brand/lx \
+	/usr/lib/brand/lx/amd64 \
+	/usr/lib/brand/lx/distros
 
 sparc_ROOT.BIN= \
 	/usr/lib/ldoms
@@ -211,6 +214,9 @@
 	/usr/include/security \
 	/usr/lib \
 	/usr/lib/abi \
+	/usr/lib/brand \
+	/usr/lib/brand/native \
+	/usr/lib/brand/sn1 \
 	/usr/lib/class \
 	/usr/lib/class/FSS \
 	/usr/lib/class/FX \
@@ -429,7 +435,14 @@
 	/var/ld/32 \
 	/usr/ucblib/32
 
+
+i386_SYM.ROOT.BIN64= \
+	/usr/lib/brand/lx/64
+
+sparc_SYM.ROOT.BIN64=
+
 SYM.ROOT.BIN64= \
+	$($(MACH)_SYM.ROOT.BIN64) \
 	/lib/64 \
 	/lib/secure/64 \
 	/usr/lib/64 \
@@ -576,6 +589,7 @@
 $(BUILD64) $(ROOT)/lib/64:=		LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/lib/secure/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/64:=		LINKDEST=$(MACH64)
+$(BUILD64) $(ROOT)/usr/lib/brand/lx/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/libp/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/lwp/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/link_audit/64:=	LINKDEST=$(MACH64)
--- a/usr/src/cmd/zoneadm/zfs.c	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/cmd/zoneadm/zfs.c	Fri Sep 15 11:26:15 2006 -0700
@@ -415,9 +415,10 @@
 	(void) printf(gettext("Cloning snapshot %s\n"), snapshot_name);
 
 	if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0 ||
-	    nvlist_add_boolean_value(props,
-	    zfs_prop_to_name(ZFS_PROP_SHARENFS), B_FALSE) != 0) {
-		nvlist_free(props);
+	    nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
+	    "off") != 0) {
+		if (props != NULL)
+			nvlist_free(props);
 		(void) fprintf(stderr, gettext("could not create ZFS clone "
 		    "%s: out of memory\n"), zonepath);
 		return (Z_ERR);
@@ -710,9 +711,10 @@
 		return;
 
 	if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0 ||
-	    nvlist_add_boolean_value(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
-	    B_FALSE) != 0) {
-		nvlist_free(props);
+	    nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
+	    "off") != 0) {
+		if (props != NULL)
+			nvlist_free(props);
 		(void) fprintf(stderr, gettext("cannot create ZFS dataset %s: "
 		    "out of memory\n"), zfs_name);
 	}
--- a/usr/src/lib/brand/Makefile.brand	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/Makefile.brand	Fri Sep 15 11:26:15 2006 -0700
@@ -61,13 +61,6 @@
 $(ROOTPROGS) :=	OWNER = root
 $(ROOTPROGS) :=	GROUP = bin
 
-$(ROOTBRANDDIR) $(ROOTTEMPLATEDIR):
-	$(INS.dir)
-
-$(ROOTBRANDDIR64):
-	$(INS.dir); cd $(ROOTBRANDDIR); \
-	$(RM) 64; $(SYMLINK) $(MACH64) 64;
-
 $(ROOTBRANDDIR)/% $(ROOTBRANDDIR64)/% $(ROOTTEMPLATEDIR)/%: %
 	$(INS.file)
 
--- a/usr/src/lib/brand/lx/cmd/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/cmd/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -39,7 +39,7 @@
 
 all:		$(PROGS)
 
-install:	all $(ROOTBRANDDIR) $(ROOTPROGS)
+install:	all $(ROOTPROGS)
 
 clean:
 	$(RM) $(PROGS)
--- a/usr/src/lib/brand/lx/librtld_db/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/librtld_db/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -43,7 +43,7 @@
 
 .KEEP_STATE:
 
-all install clean clobber: $(ROOTBRANDDIR) $(ROOTBRANDDIR64) $(SUBDIRS)
+all install clean clobber: $(SUBDIRS)
 
 lint: $(LINT_SUBDIRS)
 
--- a/usr/src/lib/brand/lx/librtld_db/amd64/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/librtld_db/amd64/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -35,4 +35,4 @@
 
 CLOBBERFILES = $(ROOTLIBDIR64)/$(DYNLIB)
 
-install: $(ROOTLIBDIR64) all $(ROOTLIBS64)
+install: all $(ROOTLIBS64)
--- a/usr/src/lib/brand/lx/librtld_db/i386/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/librtld_db/i386/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -34,4 +34,4 @@
 
 CLOBBERFILES =	$(ROOTLIBDIR)/$(DYNLIB)
 
-install: $(ROOTLIBDIR) all $(ROOTLIBS)
+install: all $(ROOTLIBS)
--- a/usr/src/lib/brand/lx/lx_brand/i386/lx_handler.s	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_brand/i386/lx_handler.s	Fri Sep 15 11:26:15 2006 -0700
@@ -195,7 +195,7 @@
 	 * Switch to the Solaris libc's %gs.
 	 */
 	movl	$LWPGS_SEL, %ebx
-	movw	%ebx, %gs
+	movw	%bx, %gs
 
 	/*
 	 * Call lx_emulate() whose only argument is a pointer to the
@@ -240,7 +240,7 @@
 	movl	0xc(%esp),%eax	/* 2nd param is a pointer */
 	movw	%gs,(%eax)	/* use the pointer to save current gs */
 	movl	0x8(%esp),%eax	/* first parameter is the new gs value */
-	movw	%eax, %gs	/* switch to the new gs value */
+	movw	%ax, %gs	/* switch to the new gs value */
 	pop	%eax		/* restore eax */
 	ret
 	SET_SIZE(lx_swap_gs)
--- a/usr/src/lib/brand/lx/lx_nametoaddr/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_nametoaddr/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -42,7 +42,7 @@
 
 .KEEP_STATE:
 
-all install clean clobber: $(ROOTBRANDDIR) $(ROOTBRANDDIR64) $(SUBDIRS)
+all install clean clobber: $(SUBDIRS)
 
 lint: $(LINT_SUBDIRS)
 
--- a/usr/src/lib/brand/lx/lx_nametoaddr/amd64/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_nametoaddr/amd64/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -32,4 +32,4 @@
 DYNFLAGS +=	$(LX_THUNK)/$(MACH64)/lx_thunk.so.1
 CLOBBERFILES =	$(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
 
-install: $(ROOTLIBDIR64) all $(ROOTLIBS64)
+install: all $(ROOTLIBS64)
--- a/usr/src/lib/brand/lx/lx_nametoaddr/i386/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_nametoaddr/i386/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -31,4 +31,4 @@
 DYNFLAGS +=	$(LX_THUNK)/$(MACH)/lx_thunk.so.1
 CLOBBERFILES =	$(ROOTLIBDIR)/$(DYNLIB) $(ROOTLIBDIR)/$(LINTLIB)
 
-install: $(ROOTLIBDIR) all $(ROOTLIBS)
+install: all $(ROOTLIBS)
--- a/usr/src/lib/brand/lx/lx_support/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_support/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -45,7 +45,7 @@
 
 .KEEP_STATE:
 
-install:	all $(ROOTBRANDDIR) $(ROOTPROGS)
+install:	all $(ROOTPROGS)
 
 clean:
 		$(RM) $(PROG) $(OBJS)
--- a/usr/src/lib/brand/lx/lx_support/lx_support.c	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_support/lx_support.c	Fri Sep 15 11:26:15 2006 -0700
@@ -54,6 +54,9 @@
 #include <sys/lx_audio.h>
 #include <sys/lx_brand.h>
 
+static void lxs_err(char *msg, ...) __NORETURN;
+static void usage(void) __NORETURN;
+
 #define	CP_CMD		"/usr/bin/cp"
 #define	MOUNT_CMD	"/sbin/mount"
 
--- a/usr/src/lib/brand/lx/lx_thunk/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_thunk/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -42,7 +42,7 @@
 
 .KEEP_STATE:
 
-all install clean clobber: $(ROOTBRANDDIR) $(ROOTBRANDDIR64) $(SUBDIRS)
+all install clean clobber: $(SUBDIRS)
 
 lint: $(LINT_SUBDIRS)
 
--- a/usr/src/lib/brand/lx/lx_thunk/amd64/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_thunk/amd64/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -31,4 +31,4 @@
 
 CLOBBERFILES	= $(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
 
-install: $(ROOTLIBDIR64) all $(ROOTLIBS64)
+install: all $(ROOTLIBS64)
--- a/usr/src/lib/brand/lx/lx_thunk/i386/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/lx_thunk/i386/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -30,4 +30,4 @@
 
 CLOBBERFILES	= $(ROOTLIBDIR)/$(DYNLIB) $(ROOTLIBDIR)/$(LINTLIB)
 
-install: $(ROOTLIBDIR) all $(ROOTLIBS)
+install: all $(ROOTLIBS)
--- a/usr/src/lib/brand/lx/netfiles/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/netfiles/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -35,7 +35,7 @@
 
 lint:
 
-install: $(ROOTBRANDDIR) $(ROOTTXTS)
+install: $(ROOTTXTS)
 
 clean:
 	-$(RM) etc_default_nfs
--- a/usr/src/lib/brand/lx/zone/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/zone/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -49,8 +49,7 @@
 
 _msg: $(MSGDOMAINPOFILE)
 
-install: $(PROGS) $(ROOTBRANDDIR) $(ROOTTEMPLATEDIR) $(ROOTXMLDOCS) \
-	$(ROOTTEMPLATES) $(ROOTPROGS) $(SUBDIRS)
+install: $(PROGS) $(ROOTXMLDOCS) $(ROOTTEMPLATES) $(ROOTPROGS) $(SUBDIRS)
 
 lint:
 
--- a/usr/src/lib/brand/lx/zone/distros/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/lx/zone/distros/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -44,7 +44,7 @@
 $(ROOTDISTRODIR)/%: %
 	$(INS.file)
 
-install: $(ROOTDISTRODIR) $(ROOTDISTROS)
+install: $(ROOTDISTROS)
 
 lint clean all:
 
--- a/usr/src/lib/brand/native/zone/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/native/zone/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -47,8 +47,7 @@
 
 lint:
 
-install: $(PROGS) $(ROOTBRANDDIR) $(ROOTPROGS) $(ROOTXMLDOCS) \
-    $(ROOTTEMPLATEDIR) $(ROOTTEMPLATES)
+install: $(PROGS) $(ROOTPROGS) $(ROOTXMLDOCS) $(ROOTTEMPLATES)
 
 clean:
 	-$(RM) $(PROGS)
--- a/usr/src/lib/brand/sn1/zone/Makefile	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/brand/sn1/zone/Makefile	Fri Sep 15 11:26:15 2006 -0700
@@ -40,8 +40,7 @@
 clean:
 	-$(RM) $(PROGS)
 
-install: $(ROOTBRANDDIR) $(ROOTPROGS) $(ROOTXMLDOCS) $(ROOTTEMPLATEDIR) \
-    $(ROOTTEMPLATES)
+install: $(ROOTPROGS) $(ROOTXMLDOCS) $(ROOTTEMPLATES)
 
 clobber:
 	-$(RM) $(ROOTPROGS) $(ROOTXMLDOCS) $(ROOTTEMPLATES)
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c	Fri Sep 15 11:26:15 2006 -0700
@@ -2248,10 +2248,10 @@
 	/* do the clone */
 	if (ZFS_IS_VOLUME(zhp)) {
 		zc.zc_objset_type = DMU_OST_ZVOL;
-		type = ZFS_TYPE_FILESYSTEM;
+		type = ZFS_TYPE_VOLUME;
 	} else {
 		zc.zc_objset_type = DMU_OST_ZFS;
-		type = ZFS_TYPE_VOLUME;
+		type = ZFS_TYPE_FILESYSTEM;
 	}
 
 	if (props) {
--- a/usr/src/uts/i86pc/ml/syscall_asm.s	Fri Sep 15 11:21:46 2006 -0700
+++ b/usr/src/uts/i86pc/ml/syscall_asm.s	Fri Sep 15 11:26:15 2006 -0700
@@ -137,7 +137,7 @@
 	pushl	%gs			/* save the user %gs		*/ ;\
 	movl	$KGS_SEL, %ebx						   ;\
 	pushl	%ebx			/* push kernel's %gs		*/ ;\
-	movw	%ebx, %gs		/* switch to the kernel's %gs	*/ ;\
+	movw	%bx, %gs		/* switch to the kernel's %gs	*/ ;\
 	movl	%gs:CPU_THREAD, %ebx	/* load the thread pointer	*/ ;\
 	movl	T_LWP(%ebx), %ebx	/* load the lwp pointer		*/ ;\
 	pushl	LWP_BRAND(%ebx)		/* push the lwp's brand data	*/ ;\
@@ -150,13 +150,13 @@
 	je	1f							   ;\
 	movl	%ebx, 20(%esp)		/* save callback to scratch	*/ ;\
 	movl	12(%esp), %ebx		/* grab the the user %gs	*/ ;\
-	movw	%ebx, %gs		/* restore the user %gs		*/ ;\
+	movw	%bx, %gs		/* restore the user %gs		*/ ;\
 	movl	16(%esp), %ebx		/* restore %ebx			*/ ;\
 	pushl	24(%esp)		/* push the return address	*/ ;\
 	call	*24(%esp)		/* call callback		*/ ;\
 	addl	$4, %esp		/* get rid of ret addr		*/ ;\
 1:	movl	12(%esp), %ebx		/* grab the the user %gs	*/ ;\
-	movw	%ebx, %gs		/* restore the user %gs		*/ ;\
+	movw	%bx, %gs		/* restore the user %gs		*/ ;\
 	movl	16(%esp), %ebx		/* restore user's %ebx		*/ ;\
 	addl	$24, %esp		/* restore stack ptr		*/