CVS commit: src/doc

2012-10-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Oct 15 08:08:02 UTC 2012

Modified Files:
src/doc: 3RDPARTY

Log Message:
tmux-1.7 is out.


To generate a diff of this commit:
cvs rdiff -u -r1.973 -r1.974 src/doc/3RDPARTY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.973 src/doc/3RDPARTY:1.974
--- src/doc/3RDPARTY:1.973	Mon Oct  8 00:12:57 2012
+++ src/doc/3RDPARTY	Mon Oct 15 08:08:01 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.973 2012/10/08 00:12:57 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.974 2012/10/15 08:08:01 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1151,7 +1151,7 @@ for the import.
 
 Package:	tmux
 Version:	1.5
-Current Vers:	1.6
+Current Vers:	1.7
 Maintainer:	Nicholas Marriott n...@users.sourceforge.net
 Archive site:	http://downloads.sourceforge.net/tmux/
 Home page:	http://tmux.sourceforge.net/



CVS commit: src/sys/arch/arm/arm32

2012-10-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 15 10:19:52 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c

Log Message:
Print the system vectors in order so I don't get confused.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/arm32/arm32_kvminit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.4 src/sys/arch/arm/arm32/arm32_kvminit.c:1.5
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.4	Sat Sep 22 00:33:37 2012
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Mon Oct 15 10:19:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.4 2012/09/22 00:33:37 matt Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.5 2012/10/15 10:19:52 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.4 2012/09/22 00:33:37 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.5 2012/10/15 10:19:52 skrll Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -806,10 +806,6 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	kernel_l1pt.pv_pa, kernel_l1pt.pv_pa + L1_TABLE_SIZE - 1,
 	kernel_l1pt.pv_va, kernel_l1pt.pv_va + L1_TABLE_SIZE - 1,
 	L1_TABLE_SIZE / PAGE_SIZE);
-	printf(mem_fmt, Exception Vectors,
-	systempage.pv_pa, systempage.pv_pa + PAGE_SIZE - 1,
-	systempage.pv_va, systempage.pv_va + PAGE_SIZE - 1,
-	1);
 	printf(mem_fmt, FIQ stack (CPU 0),
 	fiqstack.pv_pa, fiqstack.pv_pa + (FIQ_STACK_SIZE * PAGE_SIZE) - 1,
 	fiqstack.pv_va, fiqstack.pv_va + (FIQ_STACK_SIZE * PAGE_SIZE) - 1,
@@ -836,6 +832,10 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	UPAGES);
 	printf(mem_fmt_nov, Message Buffer,
 	msgbufphys, msgbufphys + msgbuf_pgs * PAGE_SIZE - 1, msgbuf_pgs);
+	printf(mem_fmt, Exception Vectors,
+	systempage.pv_pa, systempage.pv_pa + PAGE_SIZE - 1,
+	systempage.pv_va, systempage.pv_va + PAGE_SIZE - 1,
+	1);
 	for (size_t i = 0; i  bmi-bmi_nfreeblocks; i++) {
 		pv = bmi-bmi_freeblocks[i];
 



CVS commit: src/sys/arch/arm/arm32

2012-10-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 15 11:24:16 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c

Log Message:
Typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/arm32/arm32_kvminit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.5 src/sys/arch/arm/arm32/arm32_kvminit.c:1.6
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.5	Mon Oct 15 10:19:52 2012
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Mon Oct 15 11:24:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.5 2012/10/15 10:19:52 skrll Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.6 2012/10/15 11:24:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.5 2012/10/15 10:19:52 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.6 2012/10/15 11:24:15 skrll Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -303,7 +303,7 @@ valloc_pages(struct bootmem_info *bmi, p
 	static bool l1pt_found;
 
 	/*
-	 * If we haven't allcoated the kernel L1 page table and we are aligned
+	 * If we haven't allocated the kernel L1 page table and we are aligned
 	 * at a L1 table boundary, alloc the memory for it.
 	 */
 	if (!l1pt_found



CVS commit: src/sys/arch/arm/arm32

2012-10-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 15 12:26:06 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c

Log Message:
More VERBOSE_INIT_ARM output tweaks.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm32/arm32_kvminit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.6 src/sys/arch/arm/arm32/arm32_kvminit.c:1.7
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.6	Mon Oct 15 11:24:15 2012
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Mon Oct 15 12:26:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.6 2012/10/15 11:24:15 skrll Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.7 2012/10/15 12:26:06 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.6 2012/10/15 11:24:15 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.7 2012/10/15 12:26:06 skrll Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -566,7 +566,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 		pmap_link_l2pt(l1pt_va, kernel_base + idx * L2_S_SEGSIZE,
 		kernel_l2pt[idx]);
 #ifdef VERBOSE_INIT_ARM
-		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx\n,
+		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx (kernel)\n,
 		__func__, kernel_l2pt[idx].pv_va, kernel_l2pt[idx].pv_pa,
 		kernel_base + idx * L2_S_SEGSIZE);
 #endif
@@ -576,7 +576,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 		pmap_link_l2pt(l1pt_va, kernel_vm_base + idx * L2_S_SEGSIZE,
 		vmdata_l2pt[idx]);
 #ifdef VERBOSE_INIT_ARM
-		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx\n,
+		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx (vm)\n,
 		__func__, vmdata_l2pt[idx].pv_va, vmdata_l2pt[idx].pv_pa,
 		kernel_vm_base + idx * L2_S_SEGSIZE);
 #endif
@@ -584,7 +584,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	if (iovbase) {
 		pmap_link_l2pt(l1pt_va, iovbase  -L2_S_SEGSIZE, bmi-bmi_io_l2pt);
 #ifdef VERBOSE_INIT_ARM
-		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx\n,
+		printf(%s: adding L2 pt (VA %#lx, PA %#lx) for VA %#lx (io)\n,
 		__func__, bmi-bmi_io_l2pt.pv_va, bmi-bmi_io_l2pt.pv_pa,
 		iovbase  -L2_S_SEGSIZE);
 #endif
@@ -806,6 +806,10 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	kernel_l1pt.pv_pa, kernel_l1pt.pv_pa + L1_TABLE_SIZE - 1,
 	kernel_l1pt.pv_va, kernel_l1pt.pv_va + L1_TABLE_SIZE - 1,
 	L1_TABLE_SIZE / PAGE_SIZE);
+	printf(mem_fmt, ABT stack (CPU 0),
+	abtstack.pv_pa, abtstack.pv_pa + (ABT_STACK_SIZE * PAGE_SIZE) - 1,
+	abtstack.pv_va, abtstack.pv_va + (ABT_STACK_SIZE * PAGE_SIZE) - 1,
+	ABT_STACK_SIZE);
 	printf(mem_fmt, FIQ stack (CPU 0),
 	fiqstack.pv_pa, fiqstack.pv_pa + (FIQ_STACK_SIZE * PAGE_SIZE) - 1,
 	fiqstack.pv_va, fiqstack.pv_va + (FIQ_STACK_SIZE * PAGE_SIZE) - 1,
@@ -814,10 +818,6 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	irqstack.pv_pa, irqstack.pv_pa + (IRQ_STACK_SIZE * PAGE_SIZE) - 1,
 	irqstack.pv_va, irqstack.pv_va + (IRQ_STACK_SIZE * PAGE_SIZE) - 1,
 	IRQ_STACK_SIZE);
-	printf(mem_fmt, ABT stack (CPU 0),
-	abtstack.pv_pa, abtstack.pv_pa + (ABT_STACK_SIZE * PAGE_SIZE) - 1,
-	abtstack.pv_va, abtstack.pv_va + (ABT_STACK_SIZE * PAGE_SIZE) - 1,
-	ABT_STACK_SIZE);
 	printf(mem_fmt, UND stack (CPU 0),
 	undstack.pv_pa, undstack.pv_pa + (UND_STACK_SIZE * PAGE_SIZE) - 1,
 	undstack.pv_va, undstack.pv_va + (UND_STACK_SIZE * PAGE_SIZE) - 1,



CVS commit: src/sys/dev/sdmmc

2012-10-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Oct 15 13:38:53 UTC 2012

Modified Files:
src/sys/dev/sdmmc: sdhcreg.h

Log Message:
Make whitespace following preprocessor keywords consistent
with the predominating form in this file (that is, a space).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/sdmmc/sdhcreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdhcreg.h
diff -u src/sys/dev/sdmmc/sdhcreg.h:1.9 src/sys/dev/sdmmc/sdhcreg.h:1.10
--- src/sys/dev/sdmmc/sdhcreg.h:1.9	Fri Aug 31 01:45:21 2012
+++ src/sys/dev/sdmmc/sdhcreg.h	Mon Oct 15 13:38:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcreg.h,v 1.9 2012/08/31 01:45:21 matt Exp $	*/
+/*	$NetBSD: sdhcreg.h,v 1.10 2012/10/15 13:38:52 jakllsch Exp $	*/
 /*	$OpenBSD: sdhcreg.h,v 1.4 2006/07/30 17:20:40 fgsch Exp $	*/
 
 /*
@@ -17,8 +17,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef	_SDHCREG_H_
-#define	_SDHCREG_H_
+#ifndef _SDHCREG_H_
+#define _SDHCREG_H_
 
 /* Host standard register set */
 #define SDHC_DMA_ADDR			0x00
@@ -155,30 +155,25 @@
 #define  SDHC_TIMEOUT_FREQ_UNIT		(17)	/* 0=KHz, 1=MHz */
 #define  SDHC_TIMEOUT_FREQ_SHIFT	0
 #define  SDHC_TIMEOUT_FREQ_MASK		0x1f
-#define	SDHC_WATERMARK_LEVEL		0x44	/* ESDHC */
-#define	 SDHC_WATERMARK_WRITE_SHIFT	16
-#define	 SDHC_WATERMARK_WRITE_MASK	0xff
-#define	 SDHC_WATERMARK_READ_SHIFT	0
-#define	 SDHC_WATERMARK_READ_MASK	0xff
+#define SDHC_WATERMARK_LEVEL		0x44	/* ESDHC */
+#define  SDHC_WATERMARK_WRITE_SHIFT	16
+#define  SDHC_WATERMARK_WRITE_MASK	0xff
+#define  SDHC_WATERMARK_READ_SHIFT	0
+#define  SDHC_WATERMARK_READ_MASK	0xff
 #define SDHC_MAX_CAPABILITIES		0x48
-#define	SDHC_HOST_VER			0xFC
-#define  SDHC_VVN_MASK			0x0f
-#define  SDHC_VVN_SHIFT			0x04
-#define  SDHC_SVN_MASK			0x0f
-#define  SDHC_SVN_SHIFT			0x00
 #define SDHC_SLOT_INTR_STATUS		0xfc
 #define SDHC_HOST_CTL_VERSION		0xfe
 #define  SDHC_SPEC_VERS_SHIFT		0
 #define  SDHC_SPEC_VERS_MASK		0xff
 #define  SDHC_VENDOR_VERS_SHIFT		8
 #define  SDHC_VENDOR_VERS_MASK		0xff
-#define	SDHC_DMA_CTL			0x40c	/* eSDHC */
-#define	 SDHC_DMA_SNOOP			0x40
+#define SDHC_DMA_CTL			0x40c	/* eSDHC */
+#define  SDHC_DMA_SNOOP			0x40
 
 /* SDHC_SPEC_VERS */
-#define	SDHC_SPEC_VERS_100		0x00
-#define	SDHC_SPEC_VERS_200		0x01
-#define	SDHC_SPEC_VERS_300		0x02
+#define SDHC_SPEC_VERS_100		0x00
+#define SDHC_SPEC_VERS_200		0x01
+#define SDHC_SPEC_VERS_300		0x02
 
 /* SDHC_CAPABILITIES decoding */
 #define SDHC_BASE_V3_FREQ_KHZ(cap)	\
@@ -209,4 +204,4 @@
 #define SDHC_CAPABILITIES_BITS		\
 	\20\33Vdd1.8V\32Vdd3.0V\31Vdd3.3V\30SUSPEND\27DMA\26HIGHSPEED
 
-#endif	/* _SDHCREG_H_ */
+#endif /* _SDHCREG_H_ */



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 14:03:06 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_dir.c
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zfs_znode.h

Log Message:
Do reference counting for zfs range lock waiters.

Avoid cv_broadcast(cv); cv_destroy(cv); which works in Solaris only
by abuse of the condvar abstraction.

There are parts of this code that should be factored into smaller
subroutines, mainly range lock allocation and initialization, but
that would make it harder to merge newer versions of zfs, so for now
I've just expanded those parts further in-line.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.5 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.6
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.5	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c	Mon Oct 15 14:03:06 2012
@@ -96,6 +96,43 @@ zfs_match_find(zfsvfs_t *zfsvfs, znode_t
 }
 
 /*
+ * Reference counting for dirlocks.  Solaris destroys the condvar as
+ * soon as it broadcasts, which works for them because cv_wait doesn't
+ * need to use the condvar after it is woken, but which is too fast and
+ * loose with the abstraction for us in NetBSD.
+ */
+
+static int
+zfs_dirlock_hold(zfs_dirlock_t *dl, znode_t *dzp)
+{
+
+	(void)dzp;		/* ignore */
+	KASSERT(mutex_owned(dzp-z_lock));
+
+	if (dl-dl_refcnt = ULONG_MAX) /* XXX Name this constant.  */
+		return (ENFILE);	/* XXX What to do?  */
+
+	dl-dl_refcnt++;
+	return (0);
+}
+
+static void
+zfs_dirlock_rele(zfs_dirlock_t *dl, znode_t *dzp)
+{
+
+	(void)dzp;		/* ignore */
+	KASSERT(mutex_owned(dzp-z_lock));
+	KASSERT(dl-dl_refcnt  0);
+
+	if (--dl-dl_refcnt == 0) {
+		if (dl-dl_namesize != 0)
+			kmem_free(dl-dl_name, dl-dl_namesize);
+		cv_destroy(dl-dl_cv);
+		kmem_free(dl, sizeof(*dl));
+	}
+}
+
+/*
  * Lock a directory entry.  A dirlock on dzp, name protects that name
  * in dzp's directory zap object.  As long as you hold a dirlock, you can
  * assume two things: (1) dzp cannot be reaped, and (2) no other thread
@@ -246,14 +283,23 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn
 			dl-dl_sharecnt = 0;
 			dl-dl_namelock = 0;
 			dl-dl_namesize = 0;
+			dl-dl_refcnt = 1;
 			dl-dl_dzp = dzp;
 			dl-dl_next = dzp-z_dirlocks;
 			dzp-z_dirlocks = dl;
 			break;
-		} 
+		}
 		if ((flag  ZSHARED)  dl-dl_sharecnt != 0)
 			break;
+		error = zfs_dirlock_hold(dl, dzp);
+		if (error) {
+			mutex_exit(dzp-z_lock);
+			if (!(flag  ZHAVELOCK))
+rw_exit(dzp-z_name_lock);
+			return (error);
+		}
 		cv_wait(dl-dl_cv, dzp-z_lock);
+		zfs_dirlock_rele(dl, dzp);
 	}
 
 	/*
@@ -355,12 +401,8 @@ zfs_dirent_unlock(zfs_dirlock_t *dl)
 		prev_dl = cur_dl-dl_next;
 	*prev_dl = dl-dl_next;
 	cv_broadcast(dl-dl_cv);
+	zfs_dirlock_rele(dl, dzp);
 	mutex_exit(dzp-z_lock);
-
-	if (dl-dl_namesize != 0)
-		kmem_free(dl-dl_name, dl-dl_namesize);
-	cv_destroy(dl-dl_cv);
-	kmem_free(dl, sizeof (*dl));
 }
 
 /*

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.5
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.4	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h	Mon Oct 15 14:03:06 2012
@@ -186,6 +186,7 @@ typedef struct zfs_dirlock {
 	uint32_t	dl_sharecnt;	/* 0 if exclusive,  0 if shared */
 	uint8_t		dl_namelock;	/* 1 if z_name_lock is NOT held */
 	uint16_t	dl_namesize;	/* set if dl_name was allocated */
+	unsigned long	dl_refcnt;	/* reference count */
 	kcondvar_t	dl_cv;		/* wait for entry to be unlocked */
 	struct znode	*dl_dzp;	/* directory znode */
 	struct zfs_dirlock *dl_next;	/* next in z_dirlocks list */



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 14:15:59 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_rlock.c
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zfs_rlock.h

Log Message:
Do reference counting for zfs range lock waiters.

Avoid cv_broadcast(cv); cv_destroy(cv); which works in Solaris only
by abuse of the condvar abstraction.

There are parts of this code that should be factored into smaller
subroutines, mainly range lock allocation and initialization, but
that would make it harder to merge newer versions of zfs, so for now
I've just expanded those parts further in-line.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_rlock.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.1.1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.1.1.2	Sat Feb 27 22:31:26 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c	Mon Oct 15 14:15:59 2012
@@ -94,6 +94,33 @@
 
 #include sys/zfs_rlock.h
 
+static int
+zfs_range_lock_hold(rl_t *rl)
+{
+
+	KASSERT(mutex_owned(rl-r_zp-z_range_lock));
+
+	if (rl-r_refcnt = ULONG_MAX)
+		return (ENFILE); /* XXX What to do?  */
+
+	rl-r_refcnt++;
+	return (0);
+}
+
+static void
+zfs_range_lock_rele(rl_t *rl)
+{
+
+	KASSERT(mutex_owned(rl-r_zp-z_range_lock));
+	KASSERT(rl-r_refcnt  0);
+
+	if (--rl-r_refcnt == 0) {
+		cv_destroy(rl-r_wr_cv);
+		cv_destroy(rl-r_rd_cv);
+		kmem_free(rl, sizeof (rl_t));
+	}
+}
+
 /*
  * Check if a write lock can be grabbed, or wait and recheck until available.
  */
@@ -169,10 +196,12 @@ zfs_range_lock_writer(znode_t *zp, rl_t 
 		return;
 wait:
 		if (!rl-r_write_wanted) {
-			cv_init(rl-r_wr_cv, NULL, CV_DEFAULT, NULL);
 			rl-r_write_wanted = B_TRUE;
 		}
+		if (zfs_range_lock_hold(rl) != 0)
+			panic(too many waiters on zfs range lock %p, rl);
 		cv_wait(rl-r_wr_cv, zp-z_range_lock);
+		zfs_range_lock_rele(rl);
 
 		/* reset to original */
 		new-r_off = off;
@@ -205,8 +234,11 @@ zfs_range_proxify(avl_tree_t *tree, rl_t
 	proxy-r_cnt = 1;
 	proxy-r_type = RL_READER;
 	proxy-r_proxy = B_TRUE;
+	cv_init(proxy-r_wr_cv, NULL, CV_DEFAULT, NULL);
+	cv_init(proxy-r_rd_cv, NULL, CV_DEFAULT, NULL);
 	proxy-r_write_wanted = B_FALSE;
 	proxy-r_read_wanted = B_FALSE;
+	proxy-r_refcnt = 1;
 	avl_add(tree, proxy);
 
 	return (proxy);
@@ -234,6 +266,9 @@ zfs_range_split(avl_tree_t *tree, rl_t *
 	rear-r_cnt = rl-r_cnt;
 	rear-r_type = RL_READER;
 	rear-r_proxy = B_TRUE;
+	cv_init(rear-r_wr_cv, NULL, CV_DEFAULT, NULL);
+	cv_init(rear-r_rd_cv, NULL, CV_DEFAULT, NULL);
+	rear-r_refcnt = 1;
 	rear-r_write_wanted = B_FALSE;
 	rear-r_read_wanted = B_FALSE;
 
@@ -259,8 +294,11 @@ zfs_range_new_proxy(avl_tree_t *tree, ui
 	rl-r_cnt = 1;
 	rl-r_type = RL_READER;
 	rl-r_proxy = B_TRUE;
+	cv_init(rl-r_wr_cv, NULL, CV_DEFAULT, NULL);
+	cv_init(rl-r_rd_cv, NULL, CV_DEFAULT, NULL);
 	rl-r_write_wanted = B_FALSE;
 	rl-r_read_wanted = B_FALSE;
+	rl-r_refcnt = 1;
 	avl_add(tree, rl);
 }
 
@@ -372,10 +410,13 @@ retry:
 	if (prev  (off  prev-r_off + prev-r_len)) {
 		if ((prev-r_type == RL_WRITER) || (prev-r_write_wanted)) {
 			if (!prev-r_read_wanted) {
-cv_init(prev-r_rd_cv, NULL, CV_DEFAULT, NULL);
 prev-r_read_wanted = B_TRUE;
 			}
+			if (zfs_range_lock_hold(prev) != 0)
+panic(too many waiters on zfs range lock %p,
+prev);
 			cv_wait(prev-r_rd_cv, zp-z_range_lock);
+			zfs_range_lock_rele(prev);
 			goto retry;
 		}
 		if (off + len  prev-r_off + prev-r_len)
@@ -395,10 +436,13 @@ retry:
 			goto got_lock;
 		if ((next-r_type == RL_WRITER) || (next-r_write_wanted)) {
 			if (!next-r_read_wanted) {
-cv_init(next-r_rd_cv, NULL, CV_DEFAULT, NULL);
 next-r_read_wanted = B_TRUE;
 			}
+			if (zfs_range_lock_hold(next) != 0)
+panic(too many waiters on zfs range lock %p,
+next);
 			cv_wait(next-r_rd_cv, zp-z_range_lock);
+			zfs_range_lock_rele(next);
 			goto retry;
 		}
 		if (off + len = next-r_off + next-r_len)
@@ -435,20 +479,25 @@ zfs_range_lock(znode_t *zp, uint64_t off
 	new-r_cnt = 1; /* assume it's going to be in the tree */
 	new-r_type = type;
 	new-r_proxy = B_FALSE;
+	cv_init(new-r_wr_cv, NULL, CV_DEFAULT, NULL);
+	cv_init(new-r_rd_cv, NULL, CV_DEFAULT, NULL);
 	new-r_write_wanted = B_FALSE;
 	new-r_read_wanted = B_FALSE;
+	new-r_refcnt = 1;
 
 	mutex_enter(zp-z_range_lock);
 	if (type == RL_READER) {
 		/*
 		 * First check for the usual case of no locks
 		 */
-		if (avl_numnodes(zp-z_range_avl) == 0)
+		if (avl_numnodes(zp-z_range_avl) == 0) {
 			avl_add(zp-z_range_avl, 

CVS commit: src/sys/dev

2012-10-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Oct 15 17:08:33 UTC 2012

Modified Files:
src/sys/dev: DEVNAMES

Log Message:
Add ural; still needs a man page.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/dev/DEVNAMES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.279 src/sys/dev/DEVNAMES:1.280
--- src/sys/dev/DEVNAMES:1.279	Sat Sep  1 11:19:58 2012
+++ src/sys/dev/DEVNAMES	Mon Oct 15 17:08:33 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.279 2012/09/01 11:19:58 matt Exp $
+#	$NetBSD: DEVNAMES,v 1.280 2012/10/15 17:08:33 jakllsch Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -1417,6 +1417,7 @@ up			vax
 upc			MI
 upl			MI
 uplcom			MI
+ural			MI
 urio			MI
 url			MI
 urlphy			MI



CVS commit: src/tests/usr.bin/unifdef

2012-10-15 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Oct 15 17:49:59 UTC 2012

Modified Files:
src/tests/usr.bin/unifdef: t_basic.sh

Log Message:
Add a small testcase for PR/47068.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/unifdef/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/unifdef/t_basic.sh
diff -u src/tests/usr.bin/unifdef/t_basic.sh:1.5 src/tests/usr.bin/unifdef/t_basic.sh:1.6
--- src/tests/usr.bin/unifdef/t_basic.sh:1.5	Sun Mar 18 09:46:50 2012
+++ src/tests/usr.bin/unifdef/t_basic.sh	Mon Oct 15 17:49:58 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_basic.sh,v 1.5 2012/03/18 09:46:50 jruoho Exp $
+# $NetBSD: t_basic.sh,v 1.6 2012/10/15 17:49:58 njoly Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -40,6 +40,23 @@ basic_body() {
 		-x unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in
 }
 
+atf_test_case lastline
+lastline_head() {
+	atf_set descr Checks with directive on last line (PR bin/47068)
+}
+
+lastline_body() {
+
+	# With newline after cpp directive
+	printf '#ifdef foo\n#endif\n' input
+	atf_check -o file:input unifdef -Ubar input
+
+	# Without newline after cpp directive
+	printf '#ifdef foo\n#endif' input
+	atf_check -o file:input unifdef -Ubar input
+}
+
 atf_init_test_cases() {
 	atf_add_test_case basic
+	atf_add_test_case lastline
 }



CVS commit: src/distrib/notes/common

2012-10-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Oct 15 18:15:29 UTC 2012

Modified Files:
src/distrib/notes/common: main

Log Message:
Added palle@ to list of NetBSD developers


To generate a diff of this commit:
cvs rdiff -u -r1.491 -r1.492 src/distrib/notes/common/main

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.491 src/distrib/notes/common/main:1.492
--- src/distrib/notes/common/main:1.491	Wed Oct 10 17:55:16 2012
+++ src/distrib/notes/common/main	Mon Oct 15 18:15:28 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.491 2012/10/10 17:55:16 riz Exp $
+.\	$NetBSD: main,v 1.492 2012/10/15 18:15:28 palle Exp $
 .\
 .\ Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -1272,6 +1272,7 @@ If you're one of them, and would like to
 .It Ta Warner Losh Ta Mt i...@netbsd.org
 .It Ta Tomasz Luchowski Ta Mt zun...@netbsd.org
 .It Ta Federico Lupi Ta Mt feder...@netbsd.org
+.It Ta Palle Lyckegaard Ta Mt pa...@netbsd.org
 .It Ta Brett Lymn Ta Mt bl...@netbsd.org
 .It Ta MAEKAWA Masahide Ta Mt gehe...@netbsd.org
 .It Ta Anders Magnusson Ta Mt ra...@netbsd.org



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 22:43:50 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_dir.c

Log Message:
Simplify zfs dirlock reference counting.

No need to pass dzp around; dl has a pointer to it.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.6	Mon Oct 15 14:03:06 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c	Mon Oct 15 22:43:50 2012
@@ -103,11 +103,10 @@ zfs_match_find(zfsvfs_t *zfsvfs, znode_t
  */
 
 static int
-zfs_dirlock_hold(zfs_dirlock_t *dl, znode_t *dzp)
+zfs_dirlock_hold(zfs_dirlock_t *dl)
 {
 
-	(void)dzp;		/* ignore */
-	KASSERT(mutex_owned(dzp-z_lock));
+	KASSERT(mutex_owned(dl-dl_dzp-z_lock));
 
 	if (dl-dl_refcnt = ULONG_MAX) /* XXX Name this constant.  */
 		return (ENFILE);	/* XXX What to do?  */
@@ -117,11 +116,10 @@ zfs_dirlock_hold(zfs_dirlock_t *dl, znod
 }
 
 static void
-zfs_dirlock_rele(zfs_dirlock_t *dl, znode_t *dzp)
+zfs_dirlock_rele(zfs_dirlock_t *dl)
 {
 
-	(void)dzp;		/* ignore */
-	KASSERT(mutex_owned(dzp-z_lock));
+	KASSERT(mutex_owned(dl-dl_dzp-z_lock));
 	KASSERT(dl-dl_refcnt  0);
 
 	if (--dl-dl_refcnt == 0) {
@@ -291,7 +289,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn
 		}
 		if ((flag  ZSHARED)  dl-dl_sharecnt != 0)
 			break;
-		error = zfs_dirlock_hold(dl, dzp);
+		error = zfs_dirlock_hold(dl);
 		if (error) {
 			mutex_exit(dzp-z_lock);
 			if (!(flag  ZHAVELOCK))
@@ -299,7 +297,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn
 			return (error);
 		}
 		cv_wait(dl-dl_cv, dzp-z_lock);
-		zfs_dirlock_rele(dl, dzp);
+		zfs_dirlock_rele(dl);
 	}
 
 	/*
@@ -401,7 +399,7 @@ zfs_dirent_unlock(zfs_dirlock_t *dl)
 		prev_dl = cur_dl-dl_next;
 	*prev_dl = dl-dl_next;
 	cv_broadcast(dl-dl_cv);
-	zfs_dirlock_rele(dl, dzp);
+	zfs_dirlock_rele(dl);
 	mutex_exit(dzp-z_lock);
 }
 
@@ -796,7 +794,11 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod
 		if (zp_is_dir  !zfs_dirempty(zp)) {	/* dir not empty */
 			mutex_exit(zp-z_lock);
 			vn_vfsunlock(vp);
+#ifdef __NetBSD__		/* XXX Make our dumb tests happier...  */
+			return (ENOTEMPTY);
+#else
 			return (EEXIST);
+#endif
 		}
 		if (zp-z_phys-zp_links = zp_is_dir) {
 			zfs_panic_recover(zfs: link count on vnode %p is %u, 



CVS commit: src/external/cddl/osnet/sys/kern

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 22:50:25 UTC 2012

Modified Files:
src/external/cddl/osnet/sys/kern: policy.c

Log Message:
secpolicy_vnode_access must be called with the vnode lock held.

Don't unlock the vnode and then tell the caller about what the world
was like while the vnode was locked.  The world changes fast.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/sys/kern/policy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/sys/kern/policy.c
diff -u src/external/cddl/osnet/sys/kern/policy.c:1.2 src/external/cddl/osnet/sys/kern/policy.c:1.3
--- src/external/cddl/osnet/sys/kern/policy.c:1.2	Thu Jun 24 13:03:05 2010
+++ src/external/cddl/osnet/sys/kern/policy.c	Mon Oct 15 22:50:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: policy.c,v 1.2 2010/06/24 13:03:05 hannken Exp $	*/
+/*	$NetBSD: policy.c,v 1.3 2012/10/15 22:50:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -143,12 +143,10 @@ int
 secpolicy_vnode_access(kauth_cred_t cred, struct vnode *vp, uint64_t owner,
 int mode)
 {
-	int error;
 
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	error = VOP_ACCESS(vp, mode, cred);
-	VOP_UNLOCK(vp);
-	return error;
+	(void)owner;		/* XXX ignore? */
+	KASSERT(VOP_ISLOCKED(vp));
+	return VOP_ACCESS(vp, mode, cred);
 }
 
 /*



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 23:08:20 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vfsops.c
zfs_vnops.c zfs_znode.c

Log Message:
Fix various issues in zfs life cycle, locking, and vop protocol.

- Restore some zfs locking and unlocking that got lost randomly.

- Enable use of the BSD vnode lock.  Lock order: all BSD vnode locks
are taken before all zfs internal locks.  There remains an issue with
O_EXCL, to be solved later (famous last words).  KASSERT the locking
scheme up the wazoo.

- Take our cruft out of zfs_lookup and move it to zfs_netbsd_lookup.
Restore much of the way zfs_lookup looked to make merging future
versions easier.  Disable use of the namecache for now because its
locking dance is too scary to contemplate.

- Implement BSD semantics for rename, to appease our tests.  This is
a provisional kludge; eventually we need VOP_RENAME to take a flag
specifying whether to use BSD semantics or POSIX semantics.

- Simplify zfs_netbsd_reclaim and make it work.  Now that getnewvnode
never tries to vclean anything itself, we need not worry about
recursion of ZFS_OBJ_MUTEX locks.

- Clarify and fix genfs node initialization and destruction.

zfs passes most of our atf vfs tests now, including the rename races.

Still to do:

- fix the impedance mismatch between our permissions model and zfs's;
- fix O_EXCL (nontrivial);
- throw dirconc at it and see how badly it explodes;
- find why zpool sometimes wedges itself during mkfs; and
- find why pool caches sometimes seem to get corrupted.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
cvs rdiff -u -r1.11 -r1.12 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.8
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.7	Sun Nov 20 02:54:25 2011
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Mon Oct 15 23:08:19 2012
@@ -1811,6 +1811,10 @@ zfs_root(vfs_t *vfsp, vnode_t **vpp)
 		*vpp = ZTOV(rootzp);
 	dprintf(vpp - %d, error %d -- %p\n, (*vpp)-v_type, error, *vpp);
 	ZFS_EXIT(zfsvfs);
+	if (error == 0)
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+	KASSERT((error != 0) || (*vpp != NULL));
+	KASSERT((error != 0) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
 	return (error);
 }
 

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.11 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.12
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.11	Mon Oct  1 18:19:18 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Oct 15 23:08:19 2012
@@ -1197,13 +1197,12 @@ specvp_check(vnode_t **vpp, cred_t *cr)
  */
 /* ARGSUSED */
 static int
-zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
-int nameiop, cred_t *cr, int flags)
+zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp,
+int flags, vnode_t *rdir, cred_t *cr,  caller_context_t *ct,
+int *direntflags, pathname_t *realpnp)
 {
 	znode_t *zdp = VTOZ(dvp);
 	zfsvfs_t *zfsvfs = zdp-z_zfsvfs;
-	int *direntflags = NULL;
-	void *realpnp = NULL;
 	int	error = 0;
 
 	/* fast path */
@@ -1249,7 +1248,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode
 	ZFS_VERIFY_ZP(zdp);
 
 	*vpp = NULL;
-	dprintf(zfs_lookup called %s\n, nm);
+
 	if (flags  LOOKUP_XATTR) {
 #ifdef TODO
 		/*
@@ -1301,17 +1300,6 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode
 		return (error);
 	}
 
-	/*
-	 * Before tediously performing a linear scan of the directory,
-	 * check the name cache to see if the directory/name pair
-	 * we are looking for is known already.
-	 */
-
-	if ((error = cache_lookup(dvp, vpp, cnp)) = 0) {
-		ZFS_EXIT(zfsvfs);
-		return (error);
-	}
-
 	if (zfsvfs-z_utf8  u8_validate(nm, strlen(nm),
 	NULL, U8_VALIDATE_ENTIRE, error)  0) {
 		ZFS_EXIT(zfsvfs);
@@ -1323,56 +1311,6 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode
 		error = specvp_check(vpp, cr);
 
 	ZFS_EXIT(zfsvfs);
-	
-	/* Translate errors and add SAVENAME when needed. */
-	if (cnp-cn_flags  ISLASTCN) {
-		switch (nameiop) {
-		case CREATE:
-		case RENAME:
-			if (error == ENOENT) {
-error = EJUSTRETURN;
-break;
-			}
-			/* FALLTHROUGH */
-		case DELETE:
-			break;
-		}
-	}
-
-	if (error == 0  (nm[0] != '.' || nm[1] != '\0')) {
-		int ltype = 0;
-
-		if (cnp-cn_flags  ISDOTDOT) {
-			ltype = VOP_ISLOCKED(dvp);
-			VOP_UNLOCK(dvp);
-		}
-		error = vn_lock(*vpp, 

CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct 15 23:51:12 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_dir.c

Log Message:
Fail lookup of .. in a deleted directory with ENOENT.

Don't try to zget the parent, whose znode id may have been recycled
by now.

It's not clear to me how Solaris avoids this, but maybe I'm just
missing something obvious.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.8
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.7	Mon Oct 15 22:43:50 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c	Mon Oct 15 23:51:11 2012
@@ -436,9 +436,16 @@ zfs_dirlook(znode_t *dzp, char *name, vn
 			return (error);
 		}
 		rw_enter(dzp-z_parent_lock, RW_READER);
-		error = zfs_zget(zfsvfs, dzp-z_phys-zp_parent, zp);
-		if (error == 0)
-			*vpp = ZTOV(zp);
+		mutex_enter(dzp-z_lock);
+		if (dzp-z_phys-zp_links == 0) {
+			/* Directory has been rmdir'd.  */
+			error = ENOENT;
+		} else {
+			error = zfs_zget(zfsvfs, dzp-z_phys-zp_parent, zp);
+			if (error == 0)
+*vpp = ZTOV(zp);
+		}
+		mutex_exit(dzp-z_lock);
 		rw_exit(dzp-z_parent_lock);
 	} else if (zfs_has_ctldir(dzp)  strcmp(name, ZFS_CTLDIR_NAME) == 0) {
 		*vpp = zfsctl_root(dzp);



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 16 00:04:15 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Restore _PC_NO_TRUNC in zfs_netbsd_pathconf.

Accidentally clobbered it in a previous commit while moving patches
around between source trees -- oops.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.12 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.13
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.12	Mon Oct 15 23:08:19 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Oct 16 00:04:15 2012
@@ -5750,6 +5750,9 @@ zfs_netbsd_pathconf(void *v)
 		case _PC_CHOWN_RESTRICTED:
 			*ap-a_retval = 1;
 			return (0);
+		case _PC_NO_TRUNC:
+			*ap-a_retval = 1;
+			return (0);
 		case _PC_VDISABLE:
 			*ap-a_retval = _POSIX_VDISABLE;
 			return (0);



CVS commit: src/sys/arch/arm/arm

2012-10-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 16 00:25:10 UTC 2012

Modified Files:
src/sys/arch/arm/arm: disksubr_mbr.c

Log Message:
Fix a bug that armeb machine misunderstand MBR partition's offset
and size. Fixes PR#47081


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm/disksubr_mbr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm/disksubr_mbr.c
diff -u src/sys/arch/arm/arm/disksubr_mbr.c:1.13 src/sys/arch/arm/arm/disksubr_mbr.c:1.14
--- src/sys/arch/arm/arm/disksubr_mbr.c:1.13	Fri Dec  2 00:25:37 2011
+++ src/sys/arch/arm/arm/disksubr_mbr.c	Tue Oct 16 00:25:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr_mbr.c,v 1.13 2011/12/02 00:25:37 jakllsch Exp $	*/
+/*	$NetBSD: disksubr_mbr.c,v 1.14 2012/10/16 00:25:09 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr_mbr.c,v 1.13 2011/12/02 00:25:37 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr_mbr.c,v 1.14 2012/10/16 00:25:09 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -151,23 +151,23 @@ mbr_label_read(dev_t dev,
 
 			/* Install in partition e, f, g, or h. */
 			pp = lp-d_partitions['e' - 'a' + i];
-			pp-p_offset = mbrp-mbrp_start;
-			pp-p_size = mbrp-mbrp_size;
+			pp-p_offset = le32toh(mbrp-mbrp_start);
+			pp-p_size = le32toh(mbrp-mbrp_size);
 			pp-p_fstype = xlat_mbr_fstype(mbrp-mbrp_type);
 
 			/* is this ours? */
 			if (mbrp == ourmbrp) {
 /* need sector address for SCSI/IDE,
  cylinder for ESDI/ST506/RLL */
-mbrpartoff = mbrp-mbrp_start;
+mbrpartoff = le32toh(mbrp-mbrp_start);
 cyl = MBR_PCYL(mbrp-mbrp_scyl, mbrp-mbrp_ssect);
 
 #ifdef __i386__ /* XXX? */
 /* update disklabel with details */
 lp-d_partitions[2].p_size =
-mbrp-mbrp_size;
+le32toh(mbrp-mbrp_size);
 lp-d_partitions[2].p_offset = 
-mbrp-mbrp_start;
+le32toh(mbrp-mbrp_start);
 lp-d_ntracks = mbrp-mbrp_ehd + 1;
 lp-d_nsectors = MBR_PSECT(mbrp-mbrp_esect);
 lp-d_secpercyl =
@@ -250,7 +250,7 @@ mbr_label_locate(dev_t dev,
 	}
 
 	/* need sector address for SCSI/IDE, cylinder for ESDI/ST506/RLL */
-	mbrpartoff = ourmbrp-mbrp_start;
+	mbrpartoff = le32toh(ourmbrp-mbrp_start);
 	cyl = MBR_PCYL(ourmbrp-mbrp_scyl, ourmbrp-mbrp_ssect);
 
 	*cylp = cyl;