CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:22:59 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
ctfmerge: obey CTFMERGE_TERMINATE_NO_UNLINK as a tool too


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.20
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19	Fri May  3 15:50:42 2024
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sat May  4 18:22:59 2024
@@ -682,7 +682,7 @@ terminate_cleanup(void)
 	if (outfile == NULL)
 		return;
 
-#if !defined (__FreeBSD__) && !defined(__NetBSD__)
+#if !defined (__FreeBSD__) && !(defined(__NetBSD__) || HAVE_NBTOOL_CONFIG_H)
 	if (dounlink) {
 		fprintf(stderr, "Removing %s\n", outfile);
 		unlink(outfile);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-04 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat May  4 18:22:59 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
ctfmerge: obey CTFMERGE_TERMINATE_NO_UNLINK as a tool too


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18	Tue May 23 14:54:58 2023
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Fri May  3 11:50:42 2024
@@ -712,6 +712,7 @@ static void
 wq_init(workqueue_t *wq, int nfiles)
 {
 	int throttle, nslots, i;
+	const char *e;
 
 	if (getenv("CTFMERGE_MAX_SLOTS"))
 		nslots = atoi(getenv("CTFMERGE_MAX_SLOTS"));
@@ -728,17 +729,21 @@ wq_init(workqueue_t *wq, int nfiles)
 
 	wq->wq_wip = xcalloc(sizeof (wip_t) * nslots);
 	wq->wq_nwipslots = nslots;
+	e = getenv("CTFMERGE_NUM_THREADS");
+	if (e) {
+		wq->wq_nthreads = atoi(e);
+	} else {
 #ifdef _SC_NPROCESSORS_ONLN
-	wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2, nslots);
+		wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2,
+		nslots);
 #else
-	wq->wq_nthreads = 2;
+		wq->wq_nthreads = 2;
 #endif
+	}
 	wq->wq_thread = xmalloc(sizeof (pthread_t) * wq->wq_nthreads);
 
-	if (getenv("CTFMERGE_INPUT_THROTTLE"))
-		throttle = atoi(getenv("CTFMERGE_INPUT_THROTTLE"));
-	else
-		throttle = MERGE_INPUT_THROTTLE_LEN;
+	e = getenv("CTFMERGE_INPUT_THROTTLE");
+	throttle = e ? atoi(e) : MERGE_INPUT_THROTTLE_LEN;
 	wq->wq_ithrottle = throttle * wq->wq_nthreads;
 
 	debug(1, "Using %d slots, %d threads\n", wq->wq_nwipslots,



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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



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

2024-04-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 15 08:06:36 UTC 2024

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

Log Message:
Add a newline to a printf message.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.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/vdev.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c:1.6	Thu Nov 15 04:55:06 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c	Mon Apr 15 08:06:36 2024
@@ -3619,7 +3619,7 @@ vdev_deadman(vdev_t *vd)
 vq->vq_io_complete_ts);
 
 printf("SLOW IO: zio timestamp %lluns, "
-"delta %"PRIu64"ns, last io %lluns",
+"delta %"PRIu64"ns, last io %lluns\n",
 fio->io_timestamp, delta,
 vq->vq_io_complete_ts);
 



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

2024-04-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 15 08:06:36 UTC 2024

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

Log Message:
Add a newline to a printf message.


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

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



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

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

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

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.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/dmu.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c	Fri Apr  5 11:20:34 2024
@@ -2145,7 +2145,8 @@ dmu_object_wait_synced(objset_t *os, uin
 	}
 
 	for (i = 0; i < TXG_SIZE; i++) {
-		if (list_link_active(&dn->dn_dirty_link[i])) {
+		if (list_link_active(&dn->dn_dirty_link[i]) ||
+		!list_is_empty(&dn->dn_dirty_records[i])) {
 			break;
 		}
 	}



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

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

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

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


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

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



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

2023-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep 10 12:50:38 UTC 2023

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

Log Message:
Revert "Teach zfs bdevsw to do b_psize."

This is used only by dump and swap, which won't work safely on zvols
anyway.  We should make swap work eventually, but right now it's
leading unwary ussers into deadlock scenarios, so let's make it fail
early instead.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.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_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.26
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25	Mon Oct 31 10:32:28 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Sun Sep 10 12:50:38 2023
@@ -7062,29 +7062,6 @@ nb_zvol_strategy(struct buf *bp)
 	(void) zvol_strategy(bp);
 }
 
-static int
-nb_zvol_psize(dev_t dev)
-{
-	minor_t minor = getminor(dev);
-	off_t nbytes;
-	unsigned bytespersector;
-
-	if (minor == 0)		/* /dev/zfs */
-		return -1;
-
-	if (zvol_ioctl(dev, DIOCGMEDIASIZE, (intptr_t)&nbytes, 0,
-		NOCRED, NULL))
-		return -1;
-	if (zvol_ioctl(dev, DIOCGSECTORSIZE, (intptr_t)&bytespersector, 0,
-		NOCRED, NULL))
-		return -1;
-	if (bytespersector == 0) /* paranoia */
-		return -1;
-	if (nbytes/bytespersector > INT_MAX) /* paranoia */
-		return -1;
-	return nbytes/bytespersector;
-}
-
 static const struct fileops zfs_fileops = {
 	.fo_name = "zfs",
 	.fo_read = fbadop_read,
@@ -7104,7 +7081,7 @@ const struct bdevsw zfs_bdevsw = {
 	.d_strategy = nb_zvol_strategy,
 	.d_ioctl = nb_zfsdev_ioctl,
 	.d_dump = nodump,
-	.d_psize = nb_zvol_psize,
+	.d_psize = nosize,
 	.d_flag = D_DISK | D_MPSAFE
 };
 



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

2023-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep 10 12:50:38 UTC 2023

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

Log Message:
Revert "Teach zfs bdevsw to do b_psize."

This is used only by dump and swap, which won't work safely on zvols
anyway.  We should make swap work eventually, but right now it's
leading unwary ussers into deadlock scenarios, so let's make it fail
early instead.


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

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



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:04:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
fix uninitialised variable usage.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.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/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.41 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.42
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.41	Tue Nov 17 03:20:33 2020
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Thu Aug  3 08:04:07 2023
@@ -7577,7 +7577,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t a
 	}
 
 	now = mstate.dtms_timestamp = dtrace_gethrtime();
-	mstate.dtms_present |= DTRACE_MSTATE_TIMESTAMP;
+	mstate.dtms_present = DTRACE_MSTATE_TIMESTAMP;
 	vtime = dtrace_vtime_references != 0;
 
 	if (vtime && curthread->t_dtrace_start)



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:04:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
fix uninitialised variable usage.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 12:53:56 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c

Log Message:
ctfmerge: fix macOS semaphore implementation, part 2

dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-25 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu May 25 12:53:56 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c

Log Message:
ctfmerge: fix macOS semaphore implementation, part 2

dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.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/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.8
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.7	Tue May 23 19:53:24 2023
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Thu May 25 12:53:56 2023
@@ -109,9 +109,8 @@ barrier_wait(barrier_t *bar)
 			if ((errno = sema_post(&bar->bar_sem)) != 0)
 terminate("%s: sema_post(bar_sem)", __func__);
 #elif defined(HAVE_DISPATCH_SEMAPHORE_CREATE)
-			if ((error = dispatch_semaphore_signal(bar->bar_sem)) != 0)
-terminate("%s: dispatch_semaphore_signal(bar_sem) = %ld\n",
-__func__, error);
+			/* return value doesn't matter */
+			dispatch_semaphore_signal(bar->bar_sem);
 #else
 			if (sem_post(&bar->bar_sem) == -1)
 terminate("%s: sem_post(bar_sem)", __func__);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-23 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue May 23 18:54:58 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c ctfmerge.c
tdata.c

Log Message:
ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:
  ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.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/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.5	Thu Jun 20 14:33:04 2019
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Tue May 23 18:54:58 2023
@@ -42,6 +42,7 @@
  * get a return code of 0.
  */
 
+#include 
 #include 
 #ifdef illumos
 #include 
@@ -49,15 +50,19 @@
 #include 
 
 #include "barrier.h"
+#include "ctftools.h"
 
 void
 barrier_init(barrier_t *bar, int nthreads)
 {
-	pthread_mutex_init(&bar->bar_lock, NULL);
+	if ((errno = pthread_mutex_init(&bar->bar_lock, NULL)) != 0)
+		terminate("%s: pthread_mutex_init(bar_lock)", __func__);
 #ifdef illumos
-	sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL);
+	if ((errno = sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL)) != 0)
+		terminate("%s: sema_init(bar_sem)", __func__);
 #else
-	sem_init(&bar->bar_sem, 0, 0);
+	if (sem_init(&bar->bar_sem, 0, 0) == -1)
+		terminate("%s: sem_init(bar_sem)", __func__);
 #endif
 
 	bar->bar_numin = 0;
@@ -67,14 +72,19 @@ barrier_init(barrier_t *bar, int nthread
 int
 barrier_wait(barrier_t *bar)
 {
-	pthread_mutex_lock(&bar->bar_lock);
+	if ((errno = pthread_mutex_lock(&bar->bar_lock)) != 0)
+		terminate("%s: pthread_mutex_lock(bar_lock)", __func__);
 
 	if (++bar->bar_numin < bar->bar_nthr) {
-		pthread_mutex_unlock(&bar->bar_lock);
+		if ((errno = pthread_mutex_unlock(&bar->bar_lock)) != 0)
+			terminate("%s: pthread_mutex_unlock(bar_lock)",
+			__func__);
 #ifdef illumos
-		sema_wait(&bar->bar_sem);
+		if ((errno = sema_wait(&bar->bar_sem)) != 0)
+			terminate("%s: sema_wait(bar_sem)", __func__);
 #else
-		sem_wait(&bar->bar_sem);
+		if (sem_wait(&bar->bar_sem) == -1)
+			terminate("%s: sem_wait(bar_sem)", __func__);
 #endif
 
 		return (0);
@@ -86,11 +96,15 @@ barrier_wait(barrier_t *bar)
 		bar->bar_numin = 0;
 		for (i = 1; i < bar->bar_nthr; i++)
 #ifdef illumos
-			sema_post(&bar->bar_sem);
+			if ((errno = sema_post(&bar->bar_sem)) != 0)
+terminate("%s: sema_post(bar_sem)", __func__);
 #else
-			sem_post(&bar->bar_sem);
+			if (sem_post(&bar->bar_sem) == -1)
+terminate("%s: sem_post(bar_sem)", __func__);
 #endif
-		pthread_mutex_unlock(&bar->bar_lock);
+		if ((errno = pthread_mutex_unlock(&bar->bar_lock)) != 0)
+			terminate("%s: pthread_mutex_unlock(bar_lock)",
+			__func__);
 
 		return (1);
 	}

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.17 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.17	Sun Oct 13 21:32:07 2019
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Tue May 23 18:54:58 2023
@@ -373,22 +373,31 @@ init_phase_two(workqueue_t *wq)
 static void
 wip_save_work(workqueue_t *wq, wip_t *slot, int slotnum)
 {
-	pthread_mutex_lock(&wq->wq_donequeue_lock);
-
-	while (wq->wq_lastdonebatch + 1 < slot->wip_batchid)
-		pthread_cond_wait(&slot->wip_cv, &wq->wq_donequeue_lock);
+	if ((errno = pthread_mutex_lock(&wq->wq_donequeue_lock)) != 0)
+		terminate("%s: pthread_mutex_lock(wq_donequeue_lock)",
+		__func__);
+
+	while (wq->wq_lastdonebatch + 1 < slot->wip_batchid) {
+		if ((errno = pthread_cond_wait(&slot->wip_cv, &wq->wq_donequeue_lock)) != 0)
+			terminate("%s: pthread_cond_wait(wip_cv,wq_donequeue_lock)",
+			__func__);
+	}
 	assert(wq->wq_lastdonebatch + 1 == slot->wip_batchid);
 
 	fifo_add(wq->wq_donequeue, slot->wip_td);
 	wq->wq_lastdonebatch++;
-	pthread_cond_signal(&wq->wq_wip[(slotnum + 1) %
-	wq->wq_nwipslots].wip_cv);
+	const int nextslot = (slotnum + 1) % wq->wq_nwipslots;
+	if ((errno = pthread_cond_signal(&wq->wq_wip[nextslot].wip_cv)) != 0)
+		terminate("%s: pthread_cond_signal(wq_wip[%d].wip_cv)",
+		__func__, nextslot);
 
 	/* reset the slot for next use */
 	slot->wip_td = NULL;
 	slot->wip_batchi

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2023-05-23 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue May 23 18:54:58 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c ctfmerge.c
tdata.c

Log Message:
ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:
  ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

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



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

2023-03-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar  3 10:01:31 UTC 2023

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

Log Message:
Adapt zfs_netbsd_access() to ACL support.  As ZFS itself only
handles VREAD, VWRITE, VEXEC and VAPPEND we use kauth_authorize_vnode()
to handle VADMIN.

>From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 \
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.



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

2023-03-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar  3 10:01:31 UTC 2023

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

Log Message:
Adapt zfs_netbsd_access() to ACL support.  As ZFS itself only
handles VREAD, VWRITE, VEXEC and VAPPEND we use kauth_authorize_vnode()
to handle VADMIN.

>From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 \
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.80 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.81
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.80	Mon Oct  3 16:04:19 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Fri Mar  3 10:01:31 2023
@@ -5169,33 +5169,47 @@ zfs_netbsd_access(void *v)
 		accmode_t a_accmode;
 		kauth_cred_t a_cred;
 	} */ *ap = v;
-	struct vnode *vp = ap->a_vp;
-	accmode_t accmode = ap->a_accmode;
-	mode_t zfs_mode = 0;
+	vnode_t *vp = ap->a_vp;
+	znode_t *zp = VTOZ(vp);
+	accmode_t accmode;
 	kauth_cred_t cred = ap->a_cred;
-	int error;
+	int error = 0;
 
 	/*
-	 * XXX This is really random, especially the left shift by six,
-	 * and it exists only because of randomness in zfs_unix_to_v4
-	 * and zfs_zaccess_rwx in zfs_acl.c.
+	 * ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND,
 	 */
-	if (accmode & VREAD)
-		zfs_mode |= S_IROTH;
-	if (accmode & VWRITE)
-		zfs_mode |= S_IWOTH;
-	if (accmode & VEXEC)
-		zfs_mode |= S_IXOTH;
-	zfs_mode <<= 6;
+	accmode = ap->a_accmode & (VREAD|VWRITE|VEXEC|VAPPEND);
+	if (accmode != 0)
+		error = zfs_access(vp, accmode, 0, cred, NULL);
 
-	KASSERT(VOP_ISLOCKED(vp));
-	error = zfs_access(vp, zfs_mode, 0, cred, NULL);
+	/*
+	 * VADMIN has to be handled by kauth_authorize_vnode().
+	 */
+	if (error == 0) {
+		accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
+		if (accmode != 0) {
+			error = kauth_authorize_vnode(cred,
+			KAUTH_ACCESS_ACTION(accmode, vp->v_type,
+			zp->z_mode & ALLPERMS), vp, NULL,
+			genfs_can_access(vp, cred, zp->z_uid,
+			zp->z_gid, zp->z_mode & ALLPERMS, NULL, accmode));
+		}
+	}
+
+	/*
+	 * For VEXEC, ensure that at least one execute bit is set for
+	 * non-directories.
+	 */
+	if (error == 0 && (ap->a_accmode & VEXEC) != 0 && vp->v_type != VDIR &&
+	(zp->z_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) {
+		error = EACCES;
+	}
 
 	/* We expect EACCES as common error. */
 	if (error == EPERM)
 		error = EACCES;
 
-	return (error);
+	return error;
 }
 
 static int



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

2023-02-17 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Fri Feb 17 21:50:14 UTC 2023

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

Log Message:
provide pathconf for .zfs control directory. avoids errors on
ls -l ../.zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.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_ctldir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.14 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.15
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.14	Fri Nov  4 11:20:39 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c	Fri Feb 17 21:50:13 2023
@@ -1842,6 +1842,7 @@ const struct vnodeopv_entry_desc zfs_sfs
 	{ &vop_putpages_desc,		genfs_null_putpages },
 	{ &vop_islocked_desc,		genfs_islocked },
 	{ &vop_print_desc,		sfs_print },
+	{ &vop_pathconf_desc,		genfs_pathconf },
 	{ NULL, NULL }
 };
 



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

2023-02-17 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Fri Feb 17 21:50:14 UTC 2023

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

Log Message:
provide pathconf for .zfs control directory. avoids errors on
ls -l ../.zfs.


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Feb  7 22:54:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: remove unnecessary fflush()

Apply this commit from FreeBSD:

  commit f339a3ef6369b368f3a2455792a7a3a4c28f92c4
  Author: Chuck Silvers 
  Date:   Wed Feb 9 17:09:26 2022 -0800

  dtrace: remove unnecessary fflush()

  This call was added back in the early days of dtrace porting and
  no one knows why anymore.  The extra flushing causes lots of
  unnecessary CPU overhead when a script produces lots of output,
  as well as easily losing output because the command can't keep up.

  Sponsored by: Netflix
  Reviewed by:  imp, markj
  Differential Revision:https://reviews.freebsd.org/D34216


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.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/lib/libdtrace/common/dt_subr.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.16
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15	Mon Feb  6 22:22:12 2023
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c	Tue Feb  7 22:54:02 2023
@@ -725,7 +725,6 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
 
 	va_copy(ap2, ap);
 	n = vfprintf(fp, format, ap2);
-	fflush(fp);
 	va_end(ap2);
 	va_end(ap);
 



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Feb  7 22:54:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: remove unnecessary fflush()

Apply this commit from FreeBSD:

  commit f339a3ef6369b368f3a2455792a7a3a4c28f92c4
  Author: Chuck Silvers 
  Date:   Wed Feb 9 17:09:26 2022 -0800

  dtrace: remove unnecessary fflush()

  This call was added back in the early days of dtrace porting and
  no one knows why anymore.  The extra flushing causes lots of
  unnecessary CPU overhead when a script produces lots of output,
  as well as easily losing output because the command can't keep up.

  Sponsored by: Netflix
  Reviewed by:  imp, markj
  Differential Revision:https://reviews.freebsd.org/D34216


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb  6 22:22:12 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: re-fix aggregations to report from all online CPUs

Reapply the fix to dt_status() from rev 1.10
("Don't return success when the target CPU is offline")
which was lost in rev 1.12 ("sync with FreeBSD").
The FreeBSD version that we have been using since then does run on NetBSD
but always reports that CPU 0 is online and all other CPUs are offline,
because the sysctl that it uses does not exist on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.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/lib/libdtrace/common/dt_subr.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.14 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.15
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c:1.14	Sun Sep  6 21:49:32 2020
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c	Mon Feb  6 22:22:12 2023
@@ -49,6 +49,11 @@
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
+#include 
+#include 
+#include 
+#endif
 
 #include 
 
@@ -501,6 +506,27 @@ dt_ioctl(dtrace_hdl_t *dtp, u_long val, 
 	return (-1);
 }
 
+#ifdef __NetBSD__
+static bool
+cpu_online(processorid_t cpu)
+{
+	cpustate_t cs;
+	int fd, online = false;
+
+	if ((fd = open(_PATH_CPUCTL, O_RDONLY)) < 0)
+		return false;
+
+	cs.cs_id = cpu;
+	if (ioctl(fd, IOC_CPU_GETSTATE, &cs) == 0) {
+		if (cs.cs_online)
+			online = true;
+	}
+
+	close(fd);
+	return online;
+}
+#endif
+
 int
 dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
 {
@@ -509,7 +535,8 @@ dt_status(dtrace_hdl_t *dtp, processorid
 	if (v == NULL) {
 #ifdef illumos
 		return (p_online(cpu, P_STATUS));
-#else
+#endif
+#ifdef __FreeBSD__
 		int maxid = 0;
 		size_t len = sizeof(maxid);
 		if (sysctlbyname("kern.smp.maxid", &maxid, &len, NULL, 0) != 0)
@@ -517,6 +544,9 @@ dt_status(dtrace_hdl_t *dtp, processorid
 		else
 			return (cpu <= maxid ? 1 : -1);
 #endif
+#ifdef __NetBSD__
+		return cpu_online(cpu) ? 1 : -1;
+#endif
 	}
 
 	return (v->dtv_status(dtp->dt_varg, cpu));



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2023-02-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb  6 22:22:12 UTC 2023

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_subr.c

Log Message:
dtrace: re-fix aggregations to report from all online CPUs

Reapply the fix to dt_status() from rev 1.10
("Don't return success when the target CPU is offline")
which was lost in rev 1.12 ("sync with FreeBSD").
The FreeBSD version that we have been using since then does run on NetBSD
but always reports that CPU 0 is online and all other CPUs are offline,
because the sysctl that it uses does not exist on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 20:23:43 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: output.c

Log Message:
Don't bail out if the input file does not have a symbol table. This happens
with crtn.o which used to have an empty symbol table with binutils 2.34,
with binutils 2.39 has no symbol table.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/output.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/tools/ctf/cvt/output.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.10
--- src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9	Mon May 28 17:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/output.c	Sun Dec 25 15:23:42 2022
@@ -353,15 +353,17 @@ sort_iidescs(Elf *elf, const char *file,
 	match.iim_file = NULL;
 
 	if ((stidx = findelfsecidx(elf, file,
-	dynsym ? ".dynsym" : ".symtab")) < 0)
-		terminate("%s: Can't open symbol table\n", file);
-	scn = elf_getscn(elf, stidx);
-	data = elf_getdata(scn, NULL);
-	gelf_getshdr(scn, &shdr);
-	nent = shdr.sh_size / shdr.sh_entsize;
+	dynsym ? ".dynsym" : ".symtab")) < 0) {
+		nent = 0;
+	} else {
+		scn = elf_getscn(elf, stidx);
+		data = elf_getdata(scn, NULL);
+		gelf_getshdr(scn, &shdr);
+		nent = shdr.sh_size / shdr.sh_entsize;
 
-	scn = elf_getscn(elf, shdr.sh_link);
-	strdata = elf_getdata(scn, NULL);
+		scn = elf_getscn(elf, shdr.sh_link);
+		strdata = elf_getdata(scn, NULL);
+	}
 
 	iiburst = iiburst_new(td, nent);
 
@@ -665,8 +667,7 @@ write_file(Elf *src, const char *srcname
 	}
 
 	if (symtab_idx == -1) {
-		terminate("%s: Cannot find %s section\n", srcname,
-		dynsym ? "SHT_DYNSYM" : "SHT_SYMTAB");
+		goto out;
 	}
 
 	/* Add the ctf section */
@@ -709,6 +710,7 @@ write_file(Elf *src, const char *srcname
 	/* commit to disk */
 	dehdr.e_shstrndx = secxlate[sehdr.e_shstrndx];
 	gelf_update_ehdr(dst, &dehdr);
+out:
 	if (elf_update(dst, ELF_C_WRITE) < 0)
 		elfterminate(dstname, "Cannot finalize temp file");
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 20:23:43 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: output.c

Log Message:
Don't bail out if the input file does not have a symbol table. This happens
with crtn.o which used to have an empty symbol table with binutils 2.34,
with binutils 2.39 has no symbol table.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/os

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:44:29 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/os: list.c

Log Message:
Provide an empty ASSERT macro ifdef _STANDALONE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/os/list.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/os/list.c
diff -u src/external/cddl/osnet/dist/uts/common/os/list.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/os/list.c:1.2
--- src/external/cddl/osnet/dist/uts/common/os/list.c:1.1.1.1	Fri Aug  7 18:33:45 2009
+++ src/external/cddl/osnet/dist/uts/common/os/list.c	Mon Oct 31 10:44:29 2022
@@ -35,6 +35,10 @@
 #include 
 #include 
 
+#ifdef _STANDALONE
+#define	ASSERT(x)	/* nothing */
+#endif
+
 #define	list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
 #define	list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
 #define	list_empty(a) ((a)->list_head.list_next == &(a)->list_head)



CVS commit: src/external/cddl/osnet/dist/uts/common/os

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:44:29 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/os: list.c

Log Message:
Provide an empty ASSERT macro ifdef _STANDALONE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/os/list.c

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



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

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:32:28 UTC 2022

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

Log Message:
Whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.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_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.24 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.25
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.24	Mon Mar 28 12:33:20 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Mon Oct 31 10:32:28 2022
@@ -3077,7 +3077,7 @@ zfs_get_vfs(const char *resource)
 		mtx_unlock(&mountlist_mtx);
 #endif
 #ifdef __NetBSD__
-mount_iterator_t *iter;
+	mount_iterator_t *iter;
 
 	mountlist_iterator_init(&iter);
 	while ((vfsp = mountlist_iterator_next(iter)) != NULL) {



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

2022-10-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Oct 31 10:32:28 UTC 2022

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

Log Message:
Whitespace nit.


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

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



CVS commit: src/external/cddl/osnet/dist/cmd/zpool

2022-10-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Oct 24 14:22:53 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool: zpool_vdev.c

Log Message:
Remove references to GEOM from zpool(8).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.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/cmd/zpool/zpool_vdev.c
diff -u src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.5 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.6
--- src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.5	Sun Feb 16 14:06:10 2020
+++ src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c	Mon Oct 24 14:22:53 2022
@@ -482,7 +482,7 @@ make_leaf_vdev(const char *arg, uint64_t
 			if (errno == ENOENT) {
 (void) fprintf(stderr,
 gettext("cannot open '%s': no such "
-"GEOM provider\n"), arg);
+"device\n"), arg);
 (void) fprintf(stderr,
 gettext("must be a full path or "
 "shorthand device name\n"));
@@ -513,7 +513,7 @@ make_leaf_vdev(const char *arg, uint64_t
 		type = VDEV_TYPE_FILE;
 	} else {
 		(void) fprintf(stderr, gettext("cannot use '%s': must be a "
-		"GEOM provider or regular file\n"), path);
+		"device or regular file\n"), path);
 		return (NULL);
 	}
 



CVS commit: src/external/cddl/osnet/dist/cmd/zpool

2022-10-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Oct 24 14:22:53 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool: zpool_vdev.c

Log Message:
Remove references to GEOM from zpool(8).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c

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



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

2022-10-03 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Oct  3 16:04:19 UTC 2022

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

Log Message:
Revert. Spotted by hannken@ - fix needs to be in zfs_ctldir.c it is missing
VOP_PATHCONF.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 \
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.79 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.80
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.79	Tue Sep 27 10:33:21 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Oct  3 16:04:19 2022
@@ -5027,7 +5027,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong
 #endif
 
 	default:
-		return (EINVAL);
+		return (EOPNOTSUPP);
 	}
 }
 



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

2022-10-03 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Oct  3 16:04:19 UTC 2022

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

Log Message:
Revert. Spotted by hannken@ - fix needs to be in zfs_ctldir.c it is missing
VOP_PATHCONF.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 \
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.



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

2022-10-03 Thread J. Hannken-Illjes
Yes -- I suppose genfs_pathconf() is sufficient here.

--
J. Hannken-Illjes - hann...@mailbox.org

> On 3. Oct 2022, at 11:40, Frank Kardel  wrote:
> 
> 
> Good to know. So do we need to add path conf there?
> Frank
> 
> 3 Oct 2022 11:34:09 J. Hannken-Illjes :
> 
>> Frank,
>> 
>> the vnode operations for ".zfs" are in zfs_ctldir.c and there
>> is no pathconf operation here ...
>> 
>> --
>> J. Hannken-Illjes - hann...@mailbox.org
>> 
>>> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
>>> 
>>> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
>>> names and barked at them when listing the .zfs snapshot directory. Ls is 
>>> only ignoring einval at that place. So something must be wrong there wrt 
>>> tog.
>>> Frank
>>> 
>>> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
>>> 
> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
> 
> Module Name:src
> Committed By:   kardel
> Date:   Tue Sep 27 10:33:21 UTC 2022
> 
> Modified Files:
> src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
> 
> Log Message:
> for unsupported names return EINVAL as per TOG
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
> discussed with christos@
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.78 -r1.79 \
>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
 
 This is completely wrong!
 
 The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
 where zfs_netbsd_pathconf() handles the NetBSD specific names if
 zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
 unsupported names in this case.
 
 Please revert.
 
 --
 J. Hannken-Illjes - hann...@mailbox.org



signature.asc
Description: Message signed with OpenPGP


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

2022-10-03 Thread Frank Kardel


Good to know. So do we need to add path conf there?
Frank

3 Oct 2022 11:34:09 J. Hannken-Illjes :

> Frank,
> 
> the vnode operations for ".zfs" are in zfs_ctldir.c and there
> is no pathconf operation here ...
> 
> --
> J. Hannken-Illjes - hann...@mailbox.org
> 
>> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
>> 
>> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
>> names and barked at them when listing the .zfs snapshot directory. Ls is 
>> only ignoring einval at that place. So something must be wrong there wrt tog.
>> Frank
>> 
>> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
>> 
 On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
 
 Module Name:    src
 Committed By:   kardel
 Date:   Tue Sep 27 10:33:21 UTC 2022
 
 Modified Files:
     src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
 
 Log Message:
 for unsupported names return EINVAL as per TOG
 https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
 discussed with christos@
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.78 -r1.79 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
>>> 
>>> This is completely wrong!
>>> 
>>> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
>>> where zfs_netbsd_pathconf() handles the NetBSD specific names if
>>> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
>>> unsupported names in this case.
>>> 
>>> Please revert.
>>> 
>>> --
>>> J. Hannken-Illjes - hann...@mailbox.org


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

2022-10-03 Thread J. Hannken-Illjes
Frank,

the vnode operations for ".zfs" are in zfs_ctldir.c and there
is no pathconf operation here ...

--
J. Hannken-Illjes - hann...@mailbox.org

> On 3. Oct 2022, at 11:26, Frank Kardel  wrote:
> 
> Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
> names and barked at them when listing the .zfs snapshot directory. Ls is only 
> ignoring einval at that place. So something must be wrong there wrt tog.
> Frank
> 
> 3 Oct 2022 10:53:10 J. Hannken-Illjes :
> 
>>> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
>>> 
>>> Module Name:src
>>> Committed By:   kardel
>>> Date:   Tue Sep 27 10:33:21 UTC 2022
>>> 
>>> Modified Files:
>>> src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
>>> 
>>> Log Message:
>>> for unsupported names return EINVAL as per TOG
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
>>> discussed with christos@
>>> 
>>> 
>>> To generate a diff of this commit:
>>> cvs rdiff -u -r1.78 -r1.79 \
>>>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
>> 
>> This is completely wrong!
>> 
>> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
>> where zfs_netbsd_pathconf() handles the NetBSD specific names if
>> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
>> unsupported names in this case.
>> 
>> Please revert.
>> 
>> --
>> J. Hannken-Illjes - hann...@mailbox.org



signature.asc
Description: Message signed with OpenPGP


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

2022-10-03 Thread Frank Kardel
Well, I am am happy to do that. But ls got eopnotsupp for fpathconf of ACL 
names and barked at them when listing the .zfs snapshot directory. Ls is only 
ignoring einval at that place. So something must be wrong there wrt tog.
Frank

3 Oct 2022 10:53:10 J. Hannken-Illjes :

>> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
>> 
>> Module Name:    src
>> Committed By:   kardel
>> Date:   Tue Sep 27 10:33:21 UTC 2022
>> 
>> Modified Files:
>>     src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
>> 
>> Log Message:
>> for unsupported names return EINVAL as per TOG
>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
>> discussed with christos@
>> 
>> 
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.78 -r1.79 \
>>    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
> 
> This is completely wrong!
> 
> The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
> where zfs_netbsd_pathconf() handles the NetBSD specific names if
> zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
> unsupported names in this case.
> 
> Please revert.
> 
> --
> J. Hannken-Illjes - hann...@mailbox.org


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

2022-10-03 Thread J. Hannken-Illjes
> On 27. Sep 2022, at 12:33, Frank Kardel  wrote:
> 
> Module Name:  src
> Committed By: kardel
> Date: Tue Sep 27 10:33:21 UTC 2022
> 
> Modified Files:
>   src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
> 
> Log Message:
> for unsupported names return EINVAL as per TOG
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
> discussed with christos@
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.78 -r1.79 \
>src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

This is completely wrong!

The call sequence is "VOP_PATHCONF -> zfs_netbsd_pathconf -> zfs_pathconf"
where zfs_netbsd_pathconf() handles the NetBSD specific names if
zfs_pathconf() returns EOPNOTSUPP and also returns EINVAL for
unsupported names in this case.

Please revert.

--
J. Hannken-Illjes - hann...@mailbox.org


signature.asc
Description: Message signed with OpenPGP


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

2022-09-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Sep 27 10:33:21 UTC 2022

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

Log Message:
for unsupported names return EINVAL as per TOG
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
discussed with christos@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 \
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.78 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.79
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.78	Sun Mar 27 16:26:26 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Sep 27 10:33:21 2022
@@ -5027,7 +5027,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong
 #endif
 
 	default:
-		return (EOPNOTSUPP);
+		return (EINVAL);
 	}
 }
 



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

2022-09-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Sep 27 10:33:21 UTC 2022

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

Log Message:
for unsupported names return EINVAL as per TOG
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
discussed with christos@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 \
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.



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

2022-08-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Aug  3 01:53:06 UTC 2022

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

Log Message:
change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.22
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21	Wed May  4 15:49:55 2022
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Wed Aug  3 01:53:06 2022
@@ -288,6 +288,7 @@ int arc_procfd;
 #define	freemem		uvm_availmem(false)
 #define	minfree		uvmexp.freemin
 #define	desfree		uvmexp.freetarg
+#define	zfs_arc_free_target desfree
 #define	lotsfree	(desfree * 2)
 #define	availrmem	desfree
 #define	swapfs_minfree	0
@@ -387,7 +388,6 @@ int zfs_arc_grow_retry = 0;
 int zfs_arc_shrink_shift = 0;
 int zfs_arc_p_min_shift = 0;
 uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
-u_int zfs_arc_free_target = 0;
 
 /* Absolute min for arc min / max is 16MB. */
 static uint64_t arc_abs_min = 16 << 20;
@@ -395,6 +395,8 @@ static uint64_t arc_abs_min = 16 << 20;
 boolean_t zfs_compressed_arc_enabled = B_TRUE;
 
 #if defined(__FreeBSD__) && defined(_KERNEL)
+u_int zfs_arc_free_target = 0;
+
 static int sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS);
 static int sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS);
 static int sysctl_vfs_zfs_arc_max(SYSCTL_HANDLER_ARGS);



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

2022-08-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Aug  3 01:53:06 UTC 2022

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

Log Message:
change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.


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

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



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

2022-05-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed May  4 15:49:55 UTC 2022

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

Log Message:
fix ARC checks for available memory:
there's an extra check that we inherited from FreeBSD that tries to
detect KVA exhaustion on platforms with limited KVA, but the condition
that decided whether to use the extra check was using a FreeBSDism
that doesn't exist on NetBSD, resulting in this check being used on
all platforms.  on amd64 systems with lots of memory, this extra check
would result in the ARC thinking that it constantly needed to reclaim memory,
resulting in all the xcall threads running all the time but not doing
anything useful.  change this condition so that this extra check for
KVA exhaustion is only used on 32-bit platforms.  fixes PR 55707.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.20 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.21
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.20	Wed Apr 21 10:02:34 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Wed May  4 15:49:55 2022
@@ -3963,7 +3963,7 @@ arc_available_memory(void)
 	}
 
 #endif	/* illumos */
-#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
+#if !defined(_LP64)
 	/*
 	 * If we're on an i386 platform, it's possible that we'll exhaust the
 	 * kernel heap space before we ever run out of available physical
@@ -5750,7 +5750,7 @@ arc_memory_throttle(uint64_t reserve, ui
 	static uint64_t page_load = 0;
 	static uint64_t last_txg = 0;
 
-#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
+#if !defined(_LP64)
 	available_memory =
 	MIN(available_memory, ptob(vmem_size(heap_arena, VMEM_FREE)));
 #endif



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

2022-05-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed May  4 15:49:55 UTC 2022

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

Log Message:
fix ARC checks for available memory:
there's an extra check that we inherited from FreeBSD that tries to
detect KVA exhaustion on platforms with limited KVA, but the condition
that decided whether to use the extra check was using a FreeBSDism
that doesn't exist on NetBSD, resulting in this check being used on
all platforms.  on amd64 systems with lots of memory, this extra check
would result in the ARC thinking that it constantly needed to reclaim memory,
resulting in all the xcall threads running all the time but not doing
anything useful.  change this condition so that this extra check for
KVA exhaustion is only used on 32-bit platforms.  fixes PR 55707.


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2022-05-02 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Mon May  2 20:09:48 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_link.c

Log Message:
Follow FreeBSD revision <0e15d9fbeba4> and simplify #ifdef'ed code.

This change avoids redefining 'SHN_SUNW_IGNORE' if the symbol is already
present.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2022-05-02 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Mon May  2 20:09:48 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_link.c

Log Message:
Follow FreeBSD revision <0e15d9fbeba4> and simplify #ifdef'ed code.

This change avoids redefining 'SHN_SUNW_IGNORE' if the symbol is already
present.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.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/lib/libdtrace/common/dt_link.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.12 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.13
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.12	Tue Dec  3 22:10:56 2019
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c	Mon May  2 20:09:48 2022
@@ -1678,11 +1678,8 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			 * already been processed by an earlier link
 			 * invocation.
 			 */
-#ifndef illumos
-#define SHN_SUNW_IGNORE	SHN_ABS
-#endif
-			if (rsym.st_shndx != SHN_SUNW_IGNORE) {
-rsym.st_shndx = SHN_SUNW_IGNORE;
+			if (rsym.st_shndx != SHN_ABS) {
+rsym.st_shndx = SHN_ABS;
 (void) gelf_update_sym(data_sym, ndx, &rsym);
 			}
 		}



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.20
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19	Sat Nov 28 22:53:06 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sat Apr 16 07:56:45 2022
@@ -132,9 +132,7 @@ vdev_disk_flush(struct work *work, void 
 	KASSERT(vp == dvd->vd_vp);
 
 	cmd = 1;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_IOCTL(vp, DIOCCACHESYNC, &cmd, FREAD|FWRITE, kcred);
-	VOP_UNLOCK(vp, 0);
 	bp->b_error = error;
 	vdev_disk_io_intr(bp);
 }



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


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

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



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

2022-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 27 16:26:26 UTC 2022

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

Log Message:
add a kauth vnode check for adding links


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 \
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.77 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.78
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.77	Wed Dec 22 09:04:10 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Mar 27 12:26:26 2022
@@ -5794,10 +5794,19 @@ zfs_netbsd_link(void *v)
 	nm = PNBUF_GET();
 	(void)strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
 
-	vn_lock(vp, LK_EXCLUSIVE);
+	if ((error = vn_lock(vp, LK_EXCLUSIVE)) != 0) {
+		/* XXX: No ABORTOP? */
+		PNBUF_PUT(nm);
+		return error;
+	}
+	error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_ADD_LINK, vp,
+	dvp, 0);
+	if (error)
+		goto out;
 	error = zfs_link(dvp, vp, nm, cnp->cn_cred,
 	NULL, 0);
 
+out:
 	PNBUF_PUT(nm);
 	VOP_UNLOCK(vp, 0);
 	return error;



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

2022-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 27 16:26:26 UTC 2022

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

Log Message:
add a kauth vnode check for adding links


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 \
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.



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

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 17:51:23 UTC 2021

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

Log Message:
zfs: Expose hostid to zfs, as in gethostid/sethostid(3).

If set to nonzero, the hostid is recorded in the metadata of a zpool,
and checked by `zpool import' when the pool has not been explicitly
exported.  After reboot, zpool import will not need `-f' to reimport
the pool.

Setting the hostid must be done explicitly through sysctl (or the
sethostid(3) library call) on all ports except acorn32, amiga,
mvme68k, newsmips, sparc, sparc64, sun2, and sun3.  So for most users
this change will have no immediate effect.  But you can obviate the
need for `zpool import -f' by adding `kern.hostid=123456789' to
/etc/sysctl.conf and importing the pool one last time with `-f'.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.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/sys/zfs_context.h
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h:1.3	Tue Feb 16 09:54:17 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h	Tue Dec 28 17:51:23 2021
@@ -130,6 +130,7 @@ extern "C" {
 #include 
 #else /* !__NetBSD__ */
 #include 
+#include 
 #include 
 
 #include 
@@ -165,7 +166,7 @@ extern "C" {
 #define td_rul_ru
 #define UID_NOBODY			(32767)
 #define vnode_pager_setsize(vp, size)	zfs_netbsd_setsize(vp, size)
-#define zone_get_hostid(a)		0
+#define zone_get_hostid(a)		((unsigned)hostid)
 
 extern struct utsname utsname;
 



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

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 17:51:23 UTC 2021

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

Log Message:
zfs: Expose hostid to zfs, as in gethostid/sethostid(3).

If set to nonzero, the hostid is recorded in the metadata of a zpool,
and checked by `zpool import' when the pool has not been explicitly
exported.  After reboot, zpool import will not need `-f' to reimport
the pool.

Setting the hostid must be done explicitly through sysctl (or the
sethostid(3) library call) on all ports except acorn32, amiga,
mvme68k, newsmips, sparc, sparc64, sun2, and sun3.  So for most users
this change will have no immediate effect.  But you can obviate the
need for `zpool import -f' by adding `kern.hostid=123456789' to
/etc/sysctl.conf and importing the pool one last time with `-f'.


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

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



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

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

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

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
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.76 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.77
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.76	Wed Oct 20 03:08:19 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Wed Dec 22 14:04:10 2021
@@ -3503,7 +3503,17 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, i
 		if (XVA_ISSET_REQ(xvap, XAT_NODUMP)) {
 			if (xoap->xoa_nodump !=
 			((zp->z_pflags & ZFS_NODUMP) != 0)) {
+#if 0
+/*
+ * XXXSB - zfs_netbsd_setattr()
+ * has already checked if this
+ * request is authorised, and our
+ * secpolicy_xvattr() doesn't check
+ * kauth chflags.  Fix this when we
+ * migrate to openzfs.
+ */
 need_policy = TRUE;
+#endif
 			} else {
 XVA_CLR_REQ(xvap, XAT_NODUMP);
 XVA_SET_REQ(&tmpxvattr, XAT_NODUMP);



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

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

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

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
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.



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

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

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

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


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

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



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

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

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

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.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_acl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6	Tue Mar 17 00:54:03 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c	Tue Dec 21 15:08:14 2021
@@ -1661,7 +1661,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla
 			} else {
 acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs,
 ZFS_GROUP, cr, &acl_ids->z_fuidp);
-#ifdef __FreeBSD_kernel__
+#if defined(__FreeBSD_kernel__) || defined(__NetBSD__)
 gid = acl_ids->z_fgid = dzp->z_gid;
 #else
 gid = crgetgid(cr);



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

2021-11-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Nov 30 12:37:38 UTC 2021

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

Log Message:
In zfs_statvfs(), set f_bresvd and f_fresvd to 0.  Fixes random kernel
accounting suspend/resumes with erroneous values leaking out.

Note: no userland leakage as statvfs(2) handler memset 0's the buffer.

XXX: Should be fixed with a memset in VFS_STATVFS().


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.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.29 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.30
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.29	Thu Aug 27 09:57:33 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Tue Nov 30 12:37:38 2021
@@ -2182,6 +2182,7 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs 
 	statp->f_blocks = (refdbytes + availbytes) >> SPA_MINBLOCKSHIFT;
 	statp->f_bfree = availbytes / statp->f_bsize;
 	statp->f_bavail = statp->f_bfree; /* no root reservation */
+	statp->f_bresvd = 0;
 
 	/*
 	 * statvfs() should really be called statufs(), because it assumes
@@ -2196,6 +2197,7 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs 
 	statp->f_favail = statp->f_ffree;	/* no "root reservation" */
 #endif
 	statp->f_files = statp->f_ffree + usedobjs;
+	statp->f_fresvd = 0;
 
 #ifdef __FreeBSD__
 	(void) cmpldev(&d32, vfsp->vfs_dev);



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

2021-11-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Nov 30 12:37:38 UTC 2021

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

Log Message:
In zfs_statvfs(), set f_bresvd and f_fresvd to 0.  Fixes random kernel
accounting suspend/resumes with erroneous values leaking out.

Note: no userland leakage as statvfs(2) handler memset 0's the buffer.

XXX: Should be fixed with a memset in VFS_STATVFS().


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libzpool/common

2021-10-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 11:35:23 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzpool/common: kernel.c

Log Message:
Hacks to get zdb working on NetBSD:
 - Force accessing raw device but we're passed the block device.
 - Deal with wedges not returning their size on a stat(2) and use
   the DIOCGMEDIASIZE ioctl instead.

Ok chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/lib/libzpool/common/kernel.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/lib/libzpool/common/kernel.c
diff -u src/external/cddl/osnet/dist/lib/libzpool/common/kernel.c:1.2 src/external/cddl/osnet/dist/lib/libzpool/common/kernel.c:1.3
--- src/external/cddl/osnet/dist/lib/libzpool/common/kernel.c:1.2	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/lib/libzpool/common/kernel.c	Wed Oct 27 11:35:23 2021
@@ -41,6 +41,11 @@
 #include 
 #include 
 
+#ifdef __NetBSD__
+#include 
+#include 
+#endif
+
 /*
  * Emulation of kernel services in userland.
  */
@@ -447,6 +452,17 @@ vn_open(char *path, int x1, int flags, i
 	 */
 	if (strncmp(path, "/dev/", 5) == 0) {
 		char *dsk;
+#ifdef __NetBSD__
+		/*
+		 * For NetBSD, we've been passed in a block device name
+		 * but need to convert to the character device name.
+		 * XXX a bit ugly...
+		 */
+		char rawpath[MAXPATHLEN];
+
+		snprintf(rawpath, sizeof(rawpath), "/dev/r%s", path + 5);
+		path = rawpath;	/* gets strdup()'d below */
+#endif	/* __NetBSD__ */
 		fd = open64(path, O_RDONLY);
 		if (fd == -1)
 			return (errno);
@@ -454,6 +470,14 @@ vn_open(char *path, int x1, int flags, i
 			close(fd);
 			return (errno);
 		}
+#ifdef __NetBSD__
+		if (st.st_size == 0) {
+			off_t dsize;
+
+			if (ioctl(fd, DIOCGMEDIASIZE, &dsize) == 0)
+st.st_size = dsize;
+		}
+#endif	/* __NetBSD__ */
 		close(fd);
 		(void) sprintf(realpath, "%s", path);
 		dsk = strstr(path, "/dsk/");
@@ -587,6 +611,14 @@ fop_getattr(vnode_t *vp, vattr_t *vap)
 		close(vp->v_fd);
 		return (errno);
 	}
+#ifdef __NetBSD__
+	if (st.st_size == 0) {
+		off_t dsize;
+
+		if (ioctl(vp->v_fd, DIOCGMEDIASIZE, &dsize) == 0)
+			st.st_size = dsize;
+	}
+#endif	/* __NetBSD__ */
 
 	vap->va_size = st.st_size;
 	return (0);



CVS commit: src/external/cddl/osnet/dist/lib/libzpool/common

2021-10-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 11:35:23 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzpool/common: kernel.c

Log Message:
Hacks to get zdb working on NetBSD:
 - Force accessing raw device but we're passed the block device.
 - Deal with wedges not returning their size on a stat(2) and use
   the DIOCGMEDIASIZE ioctl instead.

Ok chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/lib/libzpool/common/kernel.c

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



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

2021-09-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Sep  6 08:37:43 UTC 2021

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

Log Message:
Clamp zfs nlinks at UINT32_MAX (nlink_t max) instead of (much) smaller
16-bit LINK_MAX until we bump LINK_MAX.  Fixes fts(3) problems with
"rm -rf" on zfs directories with > 32766 subdirectories.

Thanks mlelstv@ and mrg@ for helping debug this.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 \
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.74 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.75
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.74	Sun Jul 18 23:57:13 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Sep  6 08:37:43 2021
@@ -3116,7 +3116,8 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 		links = zp->z_links + 1;
 	else
 		links = zp->z_links;
-	vap->va_nlink = MIN(links, LINK_MAX);	/* nlink_t limit! */
+	/* XXX NetBSD: use LINK_MAX when that value matches 32-bit nlink_t */
+	vap->va_nlink = MIN(links, UINT32_MAX);	/* nlink_t limit! */
 	vap->va_size = zp->z_size;
 #ifdef illumos
 	vap->va_rdev = vp->v_rdev;



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

2021-09-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Sep  6 08:37:43 UTC 2021

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

Log Message:
Clamp zfs nlinks at UINT32_MAX (nlink_t max) instead of (much) smaller
16-bit LINK_MAX until we bump LINK_MAX.  Fixes fts(3) problems with
"rm -rf" on zfs directories with > 32766 subdirectories.

Thanks mlelstv@ and mrg@ for helping debug this.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 \
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.



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2021-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 28 10:47:46 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.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/lib/libzfs/common/libzfs_import.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.6 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.7
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.6	Sat Apr  4 13:45:22 2020
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c	Sat Aug 28 10:47:45 2021
@@ -1099,6 +1099,7 @@ zpool_open_func(void *arg)
 	off_t size;
 
 	/* skip devices with wedges */
+	memset(&dkwl, 0, sizeof(dkwl));
 	if (native_ioctl(fd, DIOCLWEDGES, &dkwl) == 0 &&
 	dkwl.dkwl_nwedges > 0) {
 		(void) close(fd);



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2021-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 28 10:47:46 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c

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



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

2020-11-29 Thread Yorick Hardy
On 2020-11-28, Yorick Hardy wrote:
> Module Name:  src
> Committed By: yhardy
> Date: Sat Nov 28 22:53:06 UTC 2020
> 
> Modified Files:
>   src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c
> 
> Log Message:
> Use vn_close to release the vnodes in the error handling blocks, since
> the vnodes were opened for writing. Fix proposed on current-users
> and improved by hannken@.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.18 -r1.19 \
> src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


Oops, that should have been "proposed on tech-kern":

 http://mail-index.netbsd.org/tech-kern/2020/11/28/msg026984.html

-- 
Kind regards,

Yorick Hardy


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

2020-05-07 Thread J. Hannken-Illjes
> On May 7, 2020, at 5:47 PM, Taylor R Campbell 
>  wrote:
> 
>> Module Name:src
>> Committed By:   hannken
>> Date:   Thu May  7 09:12:03 UTC 2020
>> 
>> Modified Files:
>>src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
>> 
>> Log Message:
>> Revert Rev. 1.63 and add a comment why we have to zil_commit() here:
>> 
>> Operation zfs_znode.c::zfs_zget_cleaner() depends on this
>> zil_commit() as a barrier to guarantee the znode cannot
>> get freed before its log entries are resolved.
> 
> We must be doing something wrong.
> 
> The only times we should ever call zil_commit are when someone called
> fsync or the file system is mounted sync=always.  Calling zil_commit
> whenever we delete a file absolutely wrecks performance and shouldn't
> be needed for on-disk correctness in normal zfs semantics unless I
> terribly misunderstand something, so we must be doing something wrong
> with the in-memory state if we seem to need this.

The problem is the way we get data in zfs_get_data().  Other OS use
zfs_zget() to obtain a referenced vnode/znode and use it to retrieve
tha data.  For us this results in deadlocks either as locking-against-self
if called during vcache_reclaim() or more difficult deadlocks as another
operation needs to proceed and we currently have txg stopped from syncing.

Chuq resolved it with zfs_zget_cleaner() that doesn't reference the
vnode/znode and works for in-memory znodes only so we have to guarantee
it doesn't get called after VOP_RECLAIM().

> Do you have a test case that can trigger the problem?

Under load I get use-after-free of znodes in zfs_get_data() or entirely
miss znodes here.  See the other commit asserting zfs_zget_cleaner()
never fails.

--
J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig (Germany)


signature.asc
Description: Message signed with OpenPGP


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

2020-05-07 Thread Taylor R Campbell
> Module Name:src
> Committed By:   hannken
> Date:   Thu May  7 09:12:03 UTC 2020
> 
> Modified Files:
> src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
> 
> Log Message:
> Revert Rev. 1.63 and add a comment why we have to zil_commit() here:
> 
> Operation zfs_znode.c::zfs_zget_cleaner() depends on this
> zil_commit() as a barrier to guarantee the znode cannot
> get freed before its log entries are resolved.

We must be doing something wrong.

The only times we should ever call zil_commit are when someone called
fsync or the file system is mounted sync=always.  Calling zil_commit
whenever we delete a file absolutely wrecks performance and shouldn't
be needed for on-disk correctness in normal zfs semantics unless I
terribly misunderstand something, so we must be doing something wrong
with the in-memory state if we seem to need this.

Do you have a test case that can trigger the problem?


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

2020-03-12 Thread Warner Losh
On Wed, Mar 11, 2020 at 12:13 AM J. Hannken-Illjes 
wrote:

> On 10. Mar 2020, at 13:37, Santhosh Raju  wrote:
>
> On Tue, Mar 10, 2020 at 7:25 AM Santhosh Raju  wrote:
>
>
> Module Name:src
> Committed By:   fox
> Date:   Mon Mar  9 15:40:50 UTC 2020
>
> Modified Files:
>src/external/cddl/osnet/dist/uts/common/fs/zfs: metaslab.c
>
> Log Message:
> external/cddl/osnet: Fix possible null pointer access.
>
> Detected by UBSan and fixed upstream, pick only the fix from the commit.
>
> Cherry-pick:
> From 928e8ad47d3478a3d5d01f0dd6ae74a9371af65e Mon Sep 17 00:00:00 2001
> From: Serapheim Dimitropoulos 
> Date: Wed, 20 Feb 2019 09:59:57 -0800
> Subject: [PATCH] Introduce auxiliary metaslab histograms
>
> Reviewed by: Paul Dagnelie 
> Reviewed-by: Brian Behlendorf 
> Reviewed by: Matt Ahrens 
> Signed-off-by: Serapheim Dimitropoulos 
> Closes #8358
>
> Reviewed by: kamil@
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.1.1.3 -r1.2 \
>src/external/cddl/osnet/dist/uts/common/fs/zfs/metaslab.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>
>
> Forgot to add in the commit log, the changes have been pulled in from
> upstream openzfs.
>
>
> https://github.com/openzfs/zfs/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e#diff-9fd6b453f8153161abe0728c449e6505R4386
>
> --
> Santhosh
>
>
> This is NOT our upstream --
>

Regardless of NetBSD's "official" upstream, this is the new OpenZFS
upstream. It has moved off illumos earlier in the year to ZoL which was
restructured to be cross platform. It includes FreeBSD support, though that
flavor of ZFS hasn't been completely merged back into FreeBSD just yet
(there's work in progress to make that happen). Since it's the only real
upstream today, you may need to do some updates to cope with the new ZFS
playing field.

Warner


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

2020-03-11 Thread Santhosh Raju
On Wed, Mar 11, 2020 at 7:22 AM Greg Troxel  wrote:
>
> J. Hannken-Illjes  writes:
>
> >> Forgot to add in the commit log, the changes have been pulled in from
> >> upstream openzfs.
> >>
> >> https://github.com/openzfs/zfs/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e#diff-9fd6b453f8153161abe0728c449e6505R4386
> >
> > This is NOT our upstream --
>

For the sake of completeness, the upstream issue was discussed in a
private thread and kamil@ pointed out that the commit exists in the
ZFS on FreeBSD repository too.

https://github.com/zfsonfreebsd/ZoF/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e

Which was pointed out as the upstream from which current
implementation of NetBSD's ZFS was taken.

> This seems to be hard to figure out.  Is there someplace in the tree
> that says what our upsream is, and what theirs is, and how all of the
> various trees out there relate?  And how we should be sending things,
> and getting things?
>
> I tried to figure this out, and ended up with
>
> http://wiki.netbsd.org/zfs/
>
> which has lots of \todo statements.

--
Santhosh


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

2020-03-11 Thread Martin Husemann
On Wed, Mar 11, 2020 at 08:22:26AM -0400, Greg Troxel wrote:
> This seems to be hard to figure out.  Is there someplace in the tree
> that says what our upsream is, and what theirs is, and how all of the
> various trees out there relate?  And how we should be sending things,
> and getting things?

doc/3RDPARTY - but zfs is missing there.

Martin


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

2020-03-11 Thread Greg Troxel
J. Hannken-Illjes  writes:

>> Forgot to add in the commit log, the changes have been pulled in from
>> upstream openzfs.
>> 
>> https://github.com/openzfs/zfs/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e#diff-9fd6b453f8153161abe0728c449e6505R4386
>
> This is NOT our upstream --

This seems to be hard to figure out.  Is there someplace in the tree
that says what our upsream is, and what theirs is, and how all of the
various trees out there relate?  And how we should be sending things,
and getting things?

I tried to figure this out, and ended up with

http://wiki.netbsd.org/zfs/

which has lots of \todo statements.


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

2020-03-10 Thread J . Hannken-Illjes
> On 10. Mar 2020, at 13:37, Santhosh Raju  wrote:
> 
> On Tue, Mar 10, 2020 at 7:25 AM Santhosh Raju  wrote:
>> 
>> Module Name:src
>> Committed By:   fox
>> Date:   Mon Mar  9 15:40:50 UTC 2020
>> 
>> Modified Files:
>>src/external/cddl/osnet/dist/uts/common/fs/zfs: metaslab.c
>> 
>> Log Message:
>> external/cddl/osnet: Fix possible null pointer access.
>> 
>> Detected by UBSan and fixed upstream, pick only the fix from the commit.
>> 
>> Cherry-pick:
>> From 928e8ad47d3478a3d5d01f0dd6ae74a9371af65e Mon Sep 17 00:00:00 2001
>> From: Serapheim Dimitropoulos 
>> Date: Wed, 20 Feb 2019 09:59:57 -0800
>> Subject: [PATCH] Introduce auxiliary metaslab histograms
>> 
>> Reviewed by: Paul Dagnelie 
>> Reviewed-by: Brian Behlendorf 
>> Reviewed by: Matt Ahrens 
>> Signed-off-by: Serapheim Dimitropoulos 
>> Closes #8358
>> 
>> Reviewed by: kamil@
>> 
>> 
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.1.1.3 -r1.2 \
>>src/external/cddl/osnet/dist/uts/common/fs/zfs/metaslab.c
>> 
>> Please note that diffs are not public domain; they are subject to the
>> copyright notices on the relevant files.
>> 
> 
> Forgot to add in the commit log, the changes have been pulled in from
> upstream openzfs.
> 
> https://github.com/openzfs/zfs/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e#diff-9fd6b453f8153161abe0728c449e6505R4386
> 
> --
> Santhosh

This is NOT our upstream --

--
J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig



signature.asc
Description: Message signed with OpenPGP


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

2020-03-10 Thread Santhosh Raju
On Tue, Mar 10, 2020 at 7:25 AM Santhosh Raju  wrote:
>
> Module Name:src
> Committed By:   fox
> Date:   Mon Mar  9 15:40:50 UTC 2020
>
> Modified Files:
> src/external/cddl/osnet/dist/uts/common/fs/zfs: metaslab.c
>
> Log Message:
> external/cddl/osnet: Fix possible null pointer access.
>
> Detected by UBSan and fixed upstream, pick only the fix from the commit.
>
> Cherry-pick:
> From 928e8ad47d3478a3d5d01f0dd6ae74a9371af65e Mon Sep 17 00:00:00 2001
> From: Serapheim Dimitropoulos 
> Date: Wed, 20 Feb 2019 09:59:57 -0800
> Subject: [PATCH] Introduce auxiliary metaslab histograms
>
> Reviewed by: Paul Dagnelie 
> Reviewed-by: Brian Behlendorf 
> Reviewed by: Matt Ahrens 
> Signed-off-by: Serapheim Dimitropoulos 
> Closes #8358
>
> Reviewed by: kamil@
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.1.1.3 -r1.2 \
> src/external/cddl/osnet/dist/uts/common/fs/zfs/metaslab.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>

Forgot to add in the commit log, the changes have been pulled in from
upstream openzfs.

https://github.com/openzfs/zfs/commit/928e8ad47d3478a3d5d01f0dd6ae74a9371af65e#diff-9fd6b453f8153161abe0728c449e6505R4386

--
Santhosh


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

2019-10-15 Thread Paul Goyette

On Tue, 15 Oct 2019, J. Hannken-Illjes wrote:


Should be fixed with Rev. 1.4 of
  src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c


Yup - thanks!


++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+


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

2019-10-14 Thread J. Hannken-Illjes
Should be fixed with Rev. 1.4 of
   src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c

--
J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig



> On 15. Oct 2019, at 00:13, Paul Goyette  wrote:
> 
> I'm now seeing a build error:
> 
> #   compile  libzpool/dmu_diff.pico
> /build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-gcc -O2   
> -std=gnu99-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
> -Wno-sign-compare  -Wsystem-headers   -Wno-traditional  -Wreturn-type 
> -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter 
> -Wno-sign-compare -Wold-style-definition -Wsign-compare -Wformat=2  
> -Wno-format-zero-length   -Wno-missing-field-initializers 
> -Wno-strict-prototypes -Wno-cast-qual  -Wno-discarded-qualifiers  -Wno-switch 
> -Wno-missing-prototypes -Wno-unused-variable -Wno-shadow 
> -Wno-missing-field-initializers -Wno-parentheses   -fPIE
> -Wno-unknown-pragmas -Wno-sign-compare -D_KERNTYPES -D_KERNTYPES 
> --sysroot=/build/netbsd-local/dest/amd64 -std=c99 -D_SUNOS_VTOC_16 
> -D_PROPLIB_ZFS_CONFLICT -I/build/netbsd-local/src_ro/external/cddl/osnet 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/include 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/sys 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/common/zfs 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/head 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libdevinfo 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libnvpair 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libshare/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libumem 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libuutil/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzfs/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzfs_core/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzpool/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/zfs 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/fs/zfs 
> -I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/sys -std=c99 
>  -c-fPIC   -g 
> /build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c
>  -o dmu_diff.pico
> /build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:
>  In function 'write_bytes':
> /build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:70:6:
>  error: 'struct uio' has no member named 'uio_vmspace'
>  auio.uio_vmspace = vmspace_kernel();
>  ^
> /build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:70:21:
>  warning: implicit declaration of function 'vmspace_kernel' 
> [-Wimplicit-function-declaration]
>  auio.uio_vmspace = vmspace_kernel();
> ^~
> /build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:56:13:
>  warning: variable 'auio' set but not used [-Wunused-but-set-variable]
>  struct uio auio;
> ^~~~
> *** [dmu_diff.pico] Error code 1
> 
> 
> 
> 
> 
> ++--+---+
> | Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
> | (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
> | Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
> ++--+---+



signature.asc
Description: Message signed with OpenPGP


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

2019-10-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Oct 15 06:58:13 UTC 2019

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

Log Message:
Add missing "#ifdef _KERNEL" to fix the build of userland zfs libraries.


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

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



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

2019-10-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Oct 15 06:58:13 UTC 2019

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

Log Message:
Add missing "#ifdef _KERNEL" to fix the build of userland zfs libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.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/dmu_diff.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.3	Mon Oct 14 13:18:00 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c	Tue Oct 15 06:58:12 2019
@@ -67,7 +67,9 @@ write_bytes(struct diffarg *da)
 	auio.uio_segflg = UIO_SYSSPACE;
 	auio.uio_td = da->da_td;
 #else
+#ifdef _KERNEL
 	auio.uio_vmspace = vmspace_kernel();
+#endif
 #endif /* __FreeBSD__ */
 #ifdef _KERNEL
 #ifdef __FreeBSD__



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

2019-10-14 Thread Paul Goyette

I'm now seeing a build error:

#   compile  libzpool/dmu_diff.pico
/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-gcc -O2   -std=gnu99  
  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Wno-sign-compare  -Wsystem-headers   -Wno-traditional  -Wreturn-type -Wswitch 
-Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter 
-Wno-sign-compare -Wold-style-definition -Wsign-compare -Wformat=2  
-Wno-format-zero-length   -Wno-missing-field-initializers 
-Wno-strict-prototypes -Wno-cast-qual  -Wno-discarded-qualifiers  -Wno-switch 
-Wno-missing-prototypes -Wno-unused-variable -Wno-shadow 
-Wno-missing-field-initializers -Wno-parentheses   -fPIE
-Wno-unknown-pragmas -Wno-sign-compare -D_KERNTYPES -D_KERNTYPES 
--sysroot=/build/netbsd-local/dest/amd64 -std=c99 -D_SUNOS_VTOC_16 
-D_PROPLIB_ZFS_CONFLICT -I/build/netbsd-local/src_ro/external/cddl/osnet 
-I/build/netbsd-local/src_ro/external/cddl/osnet/include 
-I/build/netbsd-local/src_ro/external/cddl/osnet/sys 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/common/zfs 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/head 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libdevinfo 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libnvpair 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libshare/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libumem 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libuutil/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzfs/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzfs_core/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/lib/libzpool/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/zfs 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/fs/zfs 
-I/build/netbsd-local/src_ro/external/cddl/osnet/dist/uts/common/sys -std=c99  
-c-fPIC   -g 
/build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c
 -o dmu_diff.pico
/build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:
 In function 'write_bytes':
/build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:70:6:
 error: 'struct uio' has no member named 'uio_vmspace'
  auio.uio_vmspace = vmspace_kernel();
  ^
/build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:70:21:
 warning: implicit declaration of function 'vmspace_kernel' 
[-Wimplicit-function-declaration]
  auio.uio_vmspace = vmspace_kernel();
 ^~
/build/netbsd-local/src_ro/external/cddl/osnet/lib/libzpool/../../dist/uts/common/fs/zfs/dmu_diff.c:56:13:
 warning: variable 'auio' set but not used [-Wunused-but-set-variable]
  struct uio auio;
 ^~~~
*** [dmu_diff.pico] Error code 1





++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+

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

2019-10-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Oct 14 13:18:00 UTC 2019

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

Log Message:
Change dmu_diff() back to use a "file" instead of a "vnode".
Command "zfs diff" calls it with a pipe, not a plain file.

Fixes PR kern/54541: kernel panic using "zfs diff"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c
cvs rdiff -u -r1.20 -r1.21 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h

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



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

2019-10-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Oct 14 13:18:00 UTC 2019

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

Log Message:
Change dmu_diff() back to use a "file" instead of a "vnode".
Command "zfs diff" calls it with a pipe, not a plain file.

Fixes PR kern/54541: kernel panic using "zfs diff"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c
cvs rdiff -u -r1.20 -r1.21 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.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/dmu_diff.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.3
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.2	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c	Mon Oct 14 13:18:00 2019
@@ -43,16 +43,13 @@
 struct diffarg {
 #ifdef __FreeBSD__
 	kthread_t *da_td;
-	struct file *da_fp;		/* file to which we are reporting */
-#else
-	struct vnode *da_vp;		/* file to which we are reporting */
 #endif
+	struct file *da_fp;		/* file to which we are reporting */
 	offset_t *da_offp;
 	int da_err;			/* error that stopped diff search */
 	dmu_diff_record_t da_ddr;
 };
 
-#ifdef __FreeBSD__
 static int
 write_bytes(struct diffarg *da)
 {
@@ -66,18 +63,30 @@ write_bytes(struct diffarg *da)
 	auio.uio_resid = aiov.iov_len;
 	auio.uio_rw = UIO_WRITE;
 	auio.uio_offset = (off_t)-1;
+#ifdef __FreeBSD__
 	auio.uio_segflg = UIO_SYSSPACE;
 	auio.uio_td = da->da_td;
+#else
+	auio.uio_vmspace = vmspace_kernel();
+#endif /* __FreeBSD__ */
 #ifdef _KERNEL
+#ifdef __FreeBSD__
 	if (da->da_fp->f_type == DTYPE_VNODE)
 		bwillwrite();
 	return (fo_write(da->da_fp, &auio, da->da_td->td_ucred, 0, da->da_td));
 #else
+	int flags = 0;
+
+	if (da->da_fp->f_type == DTYPE_VNODE)
+		flags |= FOF_UPDATE_OFFSET;
+	return (*da->da_fp->f_ops->fo_write)(da->da_fp, &da->da_fp->f_offset,
+	&auio, da->da_fp->f_cred, flags);
+#endif /* __FreeBSD__ */
+#else
 	fprintf(stderr, "%s: returning EOPNOTSUPP\n", __func__);
 	return (EOPNOTSUPP);
 #endif
 }
-#endif /* __FreeBSD__ */
 
 static int
 write_record(struct diffarg *da)
@@ -89,13 +98,7 @@ write_record(struct diffarg *da)
 		return (0);
 	}
 
-#ifdef __FreeBSD__
 	da->da_err = write_bytes(da);
-#else
-	da->da_err = vn_rdwr(UIO_WRITE, da->da_vp, (caddr_t)&da->da_ddr,
-	sizeof (da->da_ddr), 0, UIO_SYSSPACE, FAPPEND,
-	RLIM64_INFINITY, CRED(), &resid);
-#endif
 	*da->da_offp += sizeof (da->da_ddr);
 	return (da->da_err);
 }
@@ -193,11 +196,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, cons
 
 int
 dmu_diff(const char *tosnap_name, const char *fromsnap_name,
-#ifdef __FreeBSD__
 struct file *fp, offset_t *offp)
-#else
-struct vnode *vp, offset_t *offp)
-#endif
 {
 	struct diffarg da;
 	dsl_dataset_t *fromsnap;
@@ -242,10 +241,8 @@ dmu_diff(const char *tosnap_name, const 
 
 #ifdef __FreeBSD__
 	da.da_td = curthread;
-	da.da_fp = fp;
-#else
-	da.da_vp = vp;
 #endif
+	da.da_fp = fp;
 	da.da_offp = offp;
 	da.da_ddr.ddr_type = DDR_NONE;
 	da.da_ddr.ddr_first = da.da_ddr.ddr_last = 0;

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.20 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.21
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.20	Wed May 22 08:46:27 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Mon Oct 14 13:18:00 2019
@@ -5296,11 +5296,7 @@ zfs_ioc_diff(zfs_cmd_t *zc)
 
 	off = fp->f_offset;
 
-#ifdef __FreeBSD__
 	error = dmu_diff(zc->zc_name, zc->zc_value, fp, &off);
-#else
-	error = dmu_diff(zc->zc_name, zc->zc_value, fp->f_vnode, &off);
-#endif
 
 	if (off >= 0 && off <= MAXOFFSET_T)
 		fp->f_offset = off;

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.3	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h	Mon Oct 14 13:18:00 2019
@@ -957,13 +957,8 @@ typedef void (*dmu_traverse_cb_t)(objset
 void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
 dmu_traverse_cb_t cb, void *arg);
 
-#ifdef __FreeBSD__
 int dmu_diff(const char *tosnap_name, const char *fromsnap_name,
 struct file *fp, offset_t *offp);
-#else
-int dmu_diff(const char *tosnap_name, const char *fromsnap_name,
-struct vnode *vp, offset_t *offp);
-#endif
 
 /* CRC64 table */
 #define	ZF

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2019-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 13 21:32:07 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
make worker thread prototype match the pthread_create signature.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.16 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.17
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.16	Mon May 28 17:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sun Oct 13 17:32:07 2019
@@ -528,9 +528,10 @@ worker_runphase2(workqueue_t *wq)
 /*
  * Main loop for worker threads.
  */
-static void
-worker_thread(workqueue_t *wq)
+static void *
+worker_thread(void *v)
 {
+	workqueue_t *wq = v;
 	worker_runphase1(wq);
 
 	debug(2, "0x%jx: entering first barrier\n",
@@ -559,6 +560,7 @@ worker_thread(workqueue_t *wq)
 	(uintmax_t)(uintptr_t)pthread_self());
 
 	worker_runphase2(wq);
+	return NULL;
 }
 
 /*
@@ -728,8 +730,7 @@ start_threads(workqueue_t *wq)
 	pthread_sigmask(SIG_BLOCK, &sets, NULL);
 
 	for (i = 0; i < wq->wq_nthreads; i++) {
-		pthread_create(&wq->wq_thread[i], NULL,
-		(void *(*)(void *))worker_thread, wq);
+		pthread_create(&wq->wq_thread[i], NULL, worker_thread, wq);
 	}
 
 #ifdef illumos



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2019-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 13 21:32:07 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
make worker thread prototype match the pthread_create signature.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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



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

2019-10-04 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Oct  4 23:06:19 UTC 2019

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

Log Message:
For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 \
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.



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

2019-10-04 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Oct  4 23:06:19 UTC 2019

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

Log Message:
For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 \
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.52 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.53
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.52	Sat Aug 24 12:59:05 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Fri Oct  4 23:06:19 2019
@@ -5318,7 +5318,8 @@ zfs_netbsd_create(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5358,7 +5359,8 @@ zfs_netbsd_mknod(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5428,7 +5430,8 @@ zfs_netbsd_mkdir(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5717,7 +5720,8 @@ zfs_netbsd_symlink(void *v)
 		VN_KNOTE(ap->a_dvp, NOTE_WRITE);
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }



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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:59:34 UTC 2019

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

Log Message:
Add missing dmu_zfetch_fini() when dnode_create() lost the race.


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

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



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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:59:34 UTC 2019

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

Log Message:
Add missing dmu_zfetch_fini() when dnode_create() lost the race.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.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/dnode.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.8
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.7	Sun May 26 10:21:00 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c	Sat Aug 24 12:59:34 2019
@@ -447,6 +447,9 @@ dnode_create(objset_t *os, dnode_phys_t 
 	if (dnh->dnh_dnode != NULL) {
 		/* Lost the allocation race. */
 		mutex_exit(&os->os_lock);
+#ifdef __NetBSD__
+		dmu_zfetch_fini(&dn->dn_zfetch);
+#endif
 		kmem_cache_free(dnode_cache, dn);
 		return (dnh->dnh_dnode);
 	}



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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:59:06 UTC 2019

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

Log Message:
Implement kqueue support.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 \
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.51 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.52
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.51	Sat Aug 24 12:58:24 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sat Aug 24 12:59:05 2019
@@ -,6 +,16 @@ zfs_rename(vnode_t *sdvp, vnode_t **svpp
 			if (*tvpp != NULL)
 cache_purge(*tvpp);
 			cache_purge_negative(tdvp);
+#ifdef __NetBSD__
+			if (*svpp == *tvpp) {
+VN_KNOTE(sdvp, NOTE_WRITE);
+VN_KNOTE(*svpp, (szp->z_links == 0 ?
+NOTE_DELETE : NOTE_LINK));
+			} else {
+genfs_rename_knote(sdvp, *svpp, tdvp, *tvpp,
+((tzp != NULL) && (tzp->z_links == 0)));
+			}
+#endif
 		}
 	}
 
@@ -5094,6 +5104,10 @@ zfs_netbsd_write(void *v)
 {
 	struct vop_write_args *ap = v;
 	vnode_t *vp = ap->a_vp;
+	znode_t *zp = VTOZ(vp);
+	struct uio *uio = ap->a_uio;
+	off_t osize = zp->z_size;
+	int error, resid;
 
 	switch (vp->v_type) {
 	case VBLK:
@@ -5105,7 +5119,13 @@ zfs_netbsd_write(void *v)
 		return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap));
 	}
 
-	return (zfs_write(vp, ap->a_uio, ioflags(ap->a_ioflag), ap->a_cred, NULL));
+	resid = uio->uio_resid;
+	error = zfs_write(vp, uio, ioflags(ap->a_ioflag), ap->a_cred, NULL);
+	if (resid > uio->uio_resid)
+		VN_KNOTE(vp, NOTE_WRITE |
+		(zp->z_size > osize ? NOTE_EXTEND : 0));
+
+	return error;
 }
 
 static int
@@ -5296,6 +5316,8 @@ zfs_netbsd_create(void *v)
 
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
+	if (error == 0)
+		VN_KNOTE(dvp, NOTE_WRITE);
 	VOP_UNLOCK(*vpp, 0);
 
 	return (error);
@@ -5334,6 +5356,8 @@ zfs_netbsd_mknod(void *v)
 
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
+	if (error == 0)
+		VN_KNOTE(dvp, NOTE_WRITE);
 	VOP_UNLOCK(*vpp, 0);
 
 	return (error);
@@ -5363,6 +5387,10 @@ zfs_netbsd_remove(void *v)
 	error = zfs_remove(dvp, vp, nm, cnp->cn_cred);
 
 	PNBUF_PUT(nm);
+	if (error == 0) {
+		VN_KNOTE(vp, NOTE_DELETE);
+		VN_KNOTE(dvp, NOTE_WRITE);
+	}
 	vput(vp);
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	return (error);
@@ -5398,6 +5426,8 @@ zfs_netbsd_mkdir(void *v)
 
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
+	if (error == 0)
+		VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
 	VOP_UNLOCK(*vpp, 0);
 
 	return (error);
@@ -5427,6 +5457,10 @@ zfs_netbsd_rmdir(void *v)
 	error = zfs_rmdir(dvp, vp, nm, cnp->cn_cred);
 
 	PNBUF_PUT(nm);
+	if (error == 0) {
+		VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
+		VN_KNOTE(vp, NOTE_DELETE);
+	}
 	vput(vp);
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	return error;
@@ -5571,7 +5605,11 @@ zfs_netbsd_setattr(void *v)
 			return error;
 	}
 
-	return (zfs_setattr(vp, (vattr_t *)&xvap, flags, cred, NULL));
+	error = zfs_setattr(vp, (vattr_t *)&xvap, flags, cred, NULL);
+	if (error == 0)
+		VN_KNOTE(vp, NOTE_ATTRIB);
+
+	return error;
 }
 
 static int
@@ -5675,7 +5713,8 @@ zfs_netbsd_symlink(void *v)
 	error = zfs_symlink(dvp, vpp, nm, vap, target, cnp->cn_cred, 0);
 
 	PNBUF_PUT(nm);
-
+	if (error == 0)
+		VN_KNOTE(ap->a_dvp, NOTE_WRITE);
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	VOP_UNLOCK(*vpp, 0);
@@ -5716,6 +5755,10 @@ zfs_netbsd_link(void *v)
 	NULL, 0);
 
 	PNBUF_PUT(nm);
+	if (error == 0) {
+		VN_KNOTE(vp, NOTE_LINK);
+		VN_KNOTE(dvp, NOTE_WRITE);
+	}
 	VOP_UNLOCK(vp, 0);
 	return error;
 }
@@ -6235,6 +6278,7 @@ const struct vnodeopv_entry_desc zfs_vno
 	{ &vop_write_desc,		zfs_netbsd_write },
 	{ &vop_ioctl_desc,		zfs_netbsd_ioctl },
 	{ &vop_poll_desc,		genfs_poll },
+	{ &vop_kqfilter_desc,		genfs_kqfilter },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync },
 	{ &vop_remove_desc,		zfs_netbsd_remove },
 	{ &vop_link_desc,		zfs_netbsd_link },
@@ -6278,6 +6322,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ &vop_write_desc,		/**/zfs_netbsd_write },
 	{ &vop_ioctl_desc,		spec_ioctl },
 	{ &vop_poll_desc,		spec_poll },
+	{ &vop_kqfilter_desc,		spec_kqfilter },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync },
 	{ &vop_remove_desc,		spec_remove },
 	{ &vop_link_desc,		spec_link },
@@ -6321,6 +6366,7 @@ const struct vnodeopv_entry_desc zfs_fif
 	{ &vop_write_desc,		/**/zfs_netbsd_write },
 	{ &vop_ioctl_desc,		vn_fifo_bypass },
 	{ &vop_poll_desc,		vn_fifo_bypass },
+	{ &vop_kqfilter_desc,		vn_fifo_bypass },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync

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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:59:06 UTC 2019

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

Log Message:
Implement kqueue support.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 \
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.



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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:58:25 UTC 2019

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

Log Message:
Implement poll support.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 \
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.



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

2019-08-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 24 12:58:25 UTC 2019

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

Log Message:
Implement poll support.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 \
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.50 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.51
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50	Mon Jun 17 08:08:21 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sat Aug 24 12:58:24 2019
@@ -6234,6 +6234,7 @@ const struct vnodeopv_entry_desc zfs_vno
 	{ &vop_read_desc,		zfs_netbsd_read },
 	{ &vop_write_desc,		zfs_netbsd_write },
 	{ &vop_ioctl_desc,		zfs_netbsd_ioctl },
+	{ &vop_poll_desc,		genfs_poll },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync },
 	{ &vop_remove_desc,		zfs_netbsd_remove },
 	{ &vop_link_desc,		zfs_netbsd_link },
@@ -6276,6 +6277,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ &vop_read_desc,		/**/zfs_netbsd_read },
 	{ &vop_write_desc,		/**/zfs_netbsd_write },
 	{ &vop_ioctl_desc,		spec_ioctl },
+	{ &vop_poll_desc,		spec_poll },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync },
 	{ &vop_remove_desc,		spec_remove },
 	{ &vop_link_desc,		spec_link },
@@ -6318,6 +6320,7 @@ const struct vnodeopv_entry_desc zfs_fif
 	{ &vop_read_desc,		/**/zfs_netbsd_read },
 	{ &vop_write_desc,		/**/zfs_netbsd_write },
 	{ &vop_ioctl_desc,		vn_fifo_bypass },
+	{ &vop_poll_desc,		vn_fifo_bypass },
 	{ &vop_fsync_desc,		zfs_netbsd_fsync },
 	{ &vop_remove_desc,		vn_fifo_bypass },
 	{ &vop_link_desc,		vn_fifo_bypass },



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

2019-08-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 20 08:12:14 UTC 2019

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

Log Message:
Rearrange the evaluation of "dvd_maxphys" so it works for wedges too.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.12
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11	Wed Jun 12 04:20:18 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Tue Aug 20 08:12:14 2019
@@ -220,23 +220,33 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 	}
 
 	/* XXXNETBSD Once tls-maxphys gets merged this block becomes:
-		pdk = disk_find_blk(vp->v_rdev);
+		if (VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED) == 0)
+			pdk = disk_find(dkw.dkw_parent);
+		else
+			pdk = disk_find_blk(vp->v_rdev);
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
 		struct buf buf = { .b_bcount = MAXPHYS };
-		const char *dev_name;
 
-		dev_name = devsw_blk2name(major(vp->v_rdev));
-		if (dev_name) {
-			char disk_name[16];
-
-			snprintf(disk_name, sizeof(disk_name), "%s%d",
-			dev_name, DISKUNIT(vp->v_rdev));
-			pdk = disk_find(disk_name);
-			if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
-(*pdk->dk_driver->d_minphys)(&buf);
+		if (VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED) == 0) {
+			pdk = disk_find(dkw.dkw_parent);
+		} else {
+			const char *dev_name;
+
+			dev_name = devsw_blk2name(major(vp->v_rdev));
+			if (dev_name) {
+char disk_name[16];
+
+snprintf(disk_name, sizeof(disk_name), "%s%d",
+dev_name, DISKUNIT(vp->v_rdev));
+pdk = disk_find(disk_name);
+			} else {
+pdk = NULL;
+			}
 		}
+		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
+			(*pdk->dk_driver->d_minphys)(&buf);
 		dvd->vd_maxphys = buf.b_bcount;
 	}
 



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

2019-08-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 20 08:12:14 UTC 2019

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

Log Message:
Rearrange the evaluation of "dvd_maxphys" so it works for wedges too.


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2019-08-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 20 08:11:21 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
Always open the raw block devices as "" like it
comes from sysctl "hw.disknames" without attaching the raw
partition letter.  Now pools on wedges get imported too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.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/lib/libzfs/common/libzfs_import.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.4 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.5
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.4	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c	Tue Aug 20 08:11:21 2019
@@ -1262,9 +1262,7 @@ zpool_find_import_impl(libzfs_handle_t *
 			static const char mib_name[] = "hw.disknames";
 			size_t len;
 			char *disknames, *last, *name;
-			char part;
 
-			part = getrawpartition();
 			if (sysctlbyname(mib_name, NULL, &len, NULL, 0) == -1) {
 zfs_error_aux(hdl, strerror(errno));
 (void) zfs_error_fmt(hdl, EZFS_BADPATH,
@@ -1277,11 +1275,10 @@ zpool_find_import_impl(libzfs_handle_t *
 			disknames = zfs_alloc(hdl, len + 2);
 			(void)sysctlbyname(mib_name, disknames, &len, NULL, 0);
 
-
 			for ((name = strtok_r(disknames, " ", &last)); name;
 			(name = strtok_r(NULL, " ", &last))) {
 slice = zfs_alloc(hdl, sizeof (rdsk_node_t));
-slice->rn_name = zfs_asprintf(hdl, "%s%c", name, 'a' + part);
+slice->rn_name = zfs_strdup(hdl, name);
 slice->rn_avl = &slice_cache;
 slice->rn_dfd = dfd;
 slice->rn_hdl = hdl;



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2019-08-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 20 08:11:21 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
Always open the raw block devices as "" like it
comes from sysctl "hw.disknames" without attaching the raw
partition letter.  Now pools on wedges get imported too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c

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



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

2019-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 13 08:03:25 UTC 2019

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

Log Message:
Add missing "defined(__NetBSD__)" to make "zfs promote" work.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.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/dsl_dataset.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c:1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c:1.5
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c:1.4	Wed May 22 08:45:32 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c	Tue Aug 13 08:03:25 2019
@@ -2796,7 +2796,7 @@ dsl_dataset_promote_sync(void *arg, dmu_
 		ASSERT(!dsl_prop_hascb(ds));
 	}
 
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(_KERNEL)
 	mutex_exit(&spa_namespace_lock);
 
 	kmem_free(newname, MAXPATHLEN);



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

2019-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Aug 13 08:03:25 UTC 2019

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

Log Message:
Add missing "defined(__NetBSD__)" to make "zfs promote" work.


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

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



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

2019-08-07 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Aug  7 20:45:53 UTC 2019

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

Log Message:
validate the length of args (like other filesystems)

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.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.24 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.25
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.24	Mon Jun 17 08:09:57 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Wed Aug  7 20:45:53 2019
@@ -1993,6 +1993,9 @@ zfs_mount(vfs_t *vfsp, const char *path,
 	if (uap == NULL)
 		return (SET_ERROR(EINVAL));
 
+	if (*data_len < sizeof *uap)
+		return (SET_ERROR(EINVAL));
+
 	if (mvp->v_type != VDIR)
 		return (SET_ERROR(ENOTDIR));
 



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

2019-08-07 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Aug  7 20:45:53 UTC 2019

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

Log Message:
validate the length of args (like other filesystems)

ok riastradh


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

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



CVS commit: src/external/cddl/osnet/dist/lib/libdtrace/common

2019-07-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul 24 16:57:45 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/lib/libdtrace/common: dt_open.c

Log Message:
Handle automatic module loading on device open more like FreeBSD does.

Where FreeBSD uses a module "dtraceall" that depends on all dtrace
modules we now load the basic set "dtrace sdt fbt syscall" on open.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c

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



  1   2   >