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-13 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-11 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-15 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-15 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-15 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, , 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_fp->f_offset,
+	, 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_ddr,
-	sizeof (da->da_ddr), 0, UIO_SYSSPACE, FAPPEND,
-	RLIM64_INFINITY, CRED(), );
-#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, );
-#else
-	error = dmu_diff(zc->zc_name, zc->zc_value, fp->f_vnode, );
-#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	ZFS_CRC64_POLY	

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_lock);
+#ifdef __NetBSD__
+		dmu_zfetch_fini(>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 *), flags, cred, NULL));
+	error = zfs_setattr(vp, (vattr_t *), 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
 	{ _write_desc,		zfs_netbsd_write },
 	{ _ioctl_desc,		zfs_netbsd_ioctl },
 	{ _poll_desc,		genfs_poll },
+	{ _kqfilter_desc,		genfs_kqfilter },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		zfs_netbsd_remove },
 	{ _link_desc,		zfs_netbsd_link },
@@ -6278,6 +6322,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _write_desc,		/**/zfs_netbsd_write },
 	{ _ioctl_desc,		spec_ioctl },
 	{ _poll_desc,		spec_poll },
+	{ _kqfilter_desc,		spec_kqfilter },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		spec_remove },
 	{ _link_desc,		spec_link },
@@ -6321,6 +6366,7 @@ const struct vnodeopv_entry_desc zfs_fif
 	{ _write_desc,		/**/zfs_netbsd_write },
 	{ _ioctl_desc,		vn_fifo_bypass },
 	{ _poll_desc,		vn_fifo_bypass },
+	{ _kqfilter_desc,		vn_fifo_bypass },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		vn_fifo_bypass },
 	{ _link_desc,		vn_fifo_bypass },



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
 	{ _read_desc,		zfs_netbsd_read },
 	{ _write_desc,		zfs_netbsd_write },
 	{ _ioctl_desc,		zfs_netbsd_ioctl },
+	{ _poll_desc,		genfs_poll },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		zfs_netbsd_remove },
 	{ _link_desc,		zfs_netbsd_link },
@@ -6276,6 +6277,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _read_desc,		/**/zfs_netbsd_read },
 	{ _write_desc,		/**/zfs_netbsd_write },
 	{ _ioctl_desc,		spec_ioctl },
+	{ _poll_desc,		spec_poll },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		spec_remove },
 	{ _link_desc,		spec_link },
@@ -6318,6 +6320,7 @@ const struct vnodeopv_entry_desc zfs_fif
 	{ _read_desc,		/**/zfs_netbsd_read },
 	{ _write_desc,		/**/zfs_netbsd_write },
 	{ _ioctl_desc,		vn_fifo_bypass },
+	{ _poll_desc,		vn_fifo_bypass },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		vn_fifo_bypass },
 	{ _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, , 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)();
+		if (VOP_IOCTL(vp, DIOCGWEDGEINFO, , 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)();
 		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/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-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(_namespace_lock);
 
 	kmem_free(newname, MAXPATHLEN);



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/uts/common/fs/zfs

2019-06-21 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 21 10:59:50 UTC 2019

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

Log Message:
Disable assertion: illumos 7793 ztest fails assertion in dmu_tx_willuse_space


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.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_tx.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c:1.3	Sun Jun  3 03:05:56 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c	Fri Jun 21 10:59:50 2019
@@ -1427,8 +1427,10 @@ dmu_tx_willuse_space(dmu_tx_t *tx, int64
 		return;
 
 	if (delta > 0) {
+/* FreeBSD r318821, illumos 7793 ztest fails assertion in dmu_tx_willuse_space
 		ASSERT3U(refcount_count(>tx_space_written) + delta, <=,
 		tx->tx_space_towrite);
+*/
 		(void) refcount_add_many(>tx_space_written, delta, NULL);
 	} else {
 		(void) refcount_add_many(>tx_space_freed, -delta, NULL);



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

2019-06-21 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 21 10:59:50 UTC 2019

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

Log Message:
Disable assertion: illumos 7793 ztest fails assertion in dmu_tx_willuse_space


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.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-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:09:57 UTC 2019

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

Log Message:
Add native vfs_suspend()/vfs_resume() before and after
zfs_suspend_fs()/zfs_resume_fs() and get rid of dead "z_sa_hdl == NULL"
znodes before vfs_resume() to keep the vnode cache consistent.

Live rollback should work now.

PR port-xen/54273 ("zpool create pool xbd2" panics DOMU kernel)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 \
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.23 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.23	Wed May 22 08:45:32 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Mon Jun 17 08:09:57 2019
@@ -121,6 +121,7 @@ VFS_SET(zfs_vfsops, zfs, VFCF_JAIL | VFC
 
 #ifdef __NetBSD__
 
+#include 
 #include 
 #include 
 
@@ -2669,8 +2670,17 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs)
 {
 	int error;
 
+#ifdef __NetBSD__
+	if ((error = vfs_suspend(zfsvfs->z_vfs, 0)) != 0)
+		return error;
+	if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0) {
+		vfs_resume(zfsvfs->z_vfs);
+		return (error);
+	}
+#else
 	if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0)
 		return (error);
+#endif
 
 	return (0);
 }
@@ -2682,6 +2692,16 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs)
  * are the same: the relevant objset and associated dataset are owned by
  * zfsvfs, held, and long held on entry.
  */
+#ifdef __NetBSD__
+static bool
+zfs_resume_selector(void *cl, struct vnode *vp)
+{
+
+	if (zfsctl_is_node(vp))
+		return false;
+	return (VTOZ(vp)->z_sa_hdl == NULL);
+}
+#endif
 int
 zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
 {
@@ -2725,6 +2745,18 @@ bail:
 	/* release the VOPs */
 	rw_exit(>z_teardown_inactive_lock);
 	rrm_exit(>z_teardown_lock, FTAG);
+#ifdef __NetBSD__
+	struct vnode_iterator *marker;
+	vnode_t *vp;
+
+	vfs_vnode_iterator_init(zfsvfs->z_vfs, );
+	while ((vp = vfs_vnode_iterator_next(marker,
+	zfs_resume_selector, NULL))) {
+		vgone(vp);
+	}
+	vfs_vnode_iterator_destroy(marker);
+	vfs_resume(zfsvfs->z_vfs);
+#endif
 
 	if (err) {
 		/*



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

2019-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:09:57 UTC 2019

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

Log Message:
Add native vfs_suspend()/vfs_resume() before and after
zfs_suspend_fs()/zfs_resume_fs() and get rid of dead "z_sa_hdl == NULL"
znodes before vfs_resume() to keep the vnode cache consistent.

Live rollback should work now.

PR port-xen/54273 ("zpool create pool xbd2" panics DOMU kernel)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 \
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/uts/common/fs/zfs

2019-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:08:21 UTC 2019

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

Log Message:
Add fstrans_start()/fstrans_done() and bounds check to zfs_netbsd_getpages().


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 \
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.49 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.49	Mon Jun 17 08:07:56 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Jun 17 08:08:21 2019
@@ -5892,6 +5892,7 @@ zfs_netbsd_getpages(void *v)
 	kmutex_t * const mtx = uobj->vmobjlock;
 	znode_t *zp = VTOZ(vp);
 	zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+	vfs_t *mp;
 	struct vm_page *pg;
 	caddr_t va;
 	int npages, found, err = 0;
@@ -5910,10 +5911,22 @@ zfs_netbsd_getpages(void *v)
 		return EBUSY;
 	}
 
+	mp = vp->v_mount;
+	fstrans_start(mp);
+	if (vp->v_mount != mp) {
+		fstrans_done(mp);
+		return ENOENT;
+	}
 	ZFS_ENTER(zfsvfs);
 	ZFS_VERIFY_ZP(zp);
 
 	mutex_enter(mtx);
+	if (offset >= vp->v_size) {
+		mutex_exit(mtx);
+		ZFS_EXIT(zfsvfs);
+		fstrans_done(mp);
+		return EINVAL;
+	}
 	npages = 1;
 	pg = NULL;
 	uvn_findpages(uobj, offset, , , UFP_ALL);
@@ -5943,6 +5956,7 @@ zfs_netbsd_getpages(void *v)
 	ap->a_m[ap->a_centeridx] = pg;
 
 	ZFS_EXIT(zfsvfs);
+	fstrans_done(mp);
 
 	return (err);
 }



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

2019-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:08:21 UTC 2019

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

Log Message:
Add fstrans_start()/fstrans_done() and bounds check to zfs_netbsd_getpages().


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 \
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-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:07:56 UTC 2019

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

Log Message:
Skip atime update on dead "z_sa_hdl == NULL" znodes.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 \
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.48 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.49
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.48	Mon Apr 15 12:59:38 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Jun 17 08:07:56 2019
@@ -5759,7 +5759,7 @@ zfs_netbsd_reclaim(void *v)
 	/*
 	 * Process a deferred atime update.
 	 */
-	if (zp->z_atime_dirty && zp->z_unlinked == 0) {
+	if (zp->z_atime_dirty && zp->z_unlinked == 0 && zp->z_sa_hdl != NULL) {
 		dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os);
 
 		dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);



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

2019-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Jun 17 08:07:56 UTC 2019

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

Log Message:
Skip atime update on dead "z_sa_hdl == NULL" znodes.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 \
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-06-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 04:20:18 UTC 2019

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

Log Message:
Fix build with -Wgnu-designator in the ZFS code

struct buf buf = { b_bcount: MAXPHYS }; is a legacy style designator
extension and this raised a compiler error reported by a.rin@mix.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
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.10 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.10	Tue Jun 11 09:04:37 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Wed Jun 12 04:20:18 2019
@@ -224,7 +224,7 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
-		struct buf buf = { b_bcount: MAXPHYS };
+		struct buf buf = { .b_bcount = MAXPHYS };
 		const char *dev_name;
 
 		dev_name = devsw_blk2name(major(vp->v_rdev));



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

2019-06-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 04:20:18 UTC 2019

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

Log Message:
Fix build with -Wgnu-designator in the ZFS code

struct buf buf = { b_bcount: MAXPHYS }; is a legacy style designator
extension and this raised a compiler error reported by a.rin@mix.


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

2019-06-11 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jun 11 09:04:37 UTC 2019

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

Log Message:
Try to retrieve the per-disk maximum transfer size and use it instead
of MAXPHYS.  Eagerly waiting for the merge of tls-maxphys.

Addresses PR port-xen/54273: "zpool create pool xbd2" panics DOMU kernel


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.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-06-11 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jun 11 09:04:37 UTC 2019

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

Log Message:
Try to retrieve the per-disk maximum transfer size and use it instead
of MAXPHYS.  Eagerly waiting for the merge of tls-maxphys.

Addresses PR port-xen/54273: "zpool create pool xbd2" panics DOMU kernel


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.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/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.9 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.10
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.9	Sun May 26 10:22:59 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Tue Jun 11 09:04:37 2019
@@ -219,6 +219,27 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 		return (SET_ERROR(EINVAL));
 	}
 
+	/* XXXNETBSD Once tls-maxphys gets merged this block becomes:
+		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)();
+		}
+		dvd->vd_maxphys = buf.b_bcount;
+	}
+
 	/*
 	 * XXXNETBSD Compare the devid to the stored value.
 	 */
@@ -421,6 +442,7 @@ vdev_disk_io_start(zio_t *zio)
 		zio_interrupt(zio);
 		return;
 	}
+	ASSERT3U(dvd->vd_maxphys, >, 0);
 	vp = dvd->vd_vp;
 #endif
 
@@ -473,7 +495,7 @@ vdev_disk_io_start(zio_t *zio)
 		mutex_exit(vp->v_interlock);
 	}
 
-	if (bp->b_bcount <= MAXPHYS) {
+	if (bp->b_bcount <= dvd->vd_maxphys) {
 		/* We can do this I/O in one pass. */
 		(void)VOP_STRATEGY(vp, bp);
 	} else {
@@ -484,7 +506,7 @@ vdev_disk_io_start(zio_t *zio)
 		resid = zio->io_size;
 		off = 0;
 		while (resid != 0) {
-			size = uimin(resid, MAXPHYS);
+			size = uimin(resid, dvd->vd_maxphys);
 			nbp = getiobuf(vp, true);
 			nbp->b_blkno = btodb(zio->io_offset + off);
 			/* Below call increments v_numoutput. */

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h:1.3	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h	Tue Jun 11 09:04:37 2019
@@ -52,6 +52,7 @@ typedef struct vdev_disk {
 	char*vd_minor;
 	vnode_t *vd_vp;
 	struct workqueue *vd_wq;
+	int		vd_maxphys;
 #endif
 } vdev_disk_t;
 #endif



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

2019-05-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 26 10:22:59 UTC 2019

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

Log Message:
upport wedges as vdevs, use DIOCGWEDGEINFO before DIOCGPARTINFO.

PR kern/54219 zpool create pool dk5 causes kernel panic


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

2019-05-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 26 10:22:59 UTC 2019

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

Log Message:
upport wedges as vdevs, use DIOCGWEDGEINFO before DIOCGPARTINFO.

PR kern/54219 zpool create pool dk5 causes kernel panic


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
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.8 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.9
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.8	Mon Sep  3 16:29:22 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sun May 26 10:22:59 2019
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -146,6 +147,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 	spa_t *spa = vd->vdev_spa;
 	vdev_disk_t *dvd;
 	vnode_t *vp;
+	struct dkwedge_info dkw;
+	struct disk *pdk;
 	int error, cmd;
 	struct partinfo pinfo;
 
@@ -235,9 +238,20 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 skip_open:
 	/*
 	 * Determine the actual size of the device.
-	 * XXXNETBSD wedges.
+	 * Try wedge info first as it supports larger disks.
 	 */
-	error = VOP_IOCTL(vp, DIOCGPARTINFO, , FREAD|FWRITE, kcred);
+	error = VOP_IOCTL(vp, DIOCGWEDGEINFO, , FREAD, NOCRED);
+	if (error == 0) {
+		pdk = disk_find(dkw.dkw_parent);
+		if (pdk) {
+			pinfo.pi_secsize = (1 << pdk->dk_byteshift);
+			pinfo.pi_size = dkw.dkw_size;
+			pinfo.pi_offset = dkw.dkw_offset;
+		} else	
+			error = ENODEV;
+	}
+	if (error)
+		error = VOP_IOCTL(vp, DIOCGPARTINFO, , FREAD, kcred);
 	if (error != 0) {
 		vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
 		return (SET_ERROR(error));



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

2019-05-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed May 22 08:46:27 UTC 2019

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

Log Message:
Add missing zvol_close() to zfsdev_close().

Change zvol_size_changed() to initialize "zv->zv_volsize"
and initialize only "dg_secsize" and "dg_secperunit".
Calling disk_set_info() will initialize the remaining
parts of the geometry.

Set "doread" in zvol_strategy() to make reading from
device possible.

Reorganize/add disk_busy()/disk_unbusy() instrumentation.

Redo zvol_ioctl() to implement DIOCGWEDGEINFO and let
disk_ioctl() process the remaining ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.10 -r1.11 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.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-05-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed May 22 08:45:32 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dsl_dataset.c dsl_dir.c
spa.c zfs_ioctl.c zfs_vfsops.c zvol.c
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zvol.h

Log Message:
Enable the zvol minor management to create and remove device nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.22 -r1.23 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
cvs rdiff -u -r1.9 -r1.10 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zvol.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-05-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed May 22 08:45:32 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dsl_dataset.c dsl_dir.c
spa.c zfs_ioctl.c zfs_vfsops.c zvol.c
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zvol.h

Log Message:
Enable the zvol minor management to create and remove device nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.22 -r1.23 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
cvs rdiff -u -r1.9 -r1.10 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zvol.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/dsl_dataset.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c:1.3 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.3	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c	Wed May 22 08:45:32 2019
@@ -1612,7 +1612,7 @@ dsl_dataset_snapshot(nvlist_t *snaps, nv
 		fnvlist_free(suspended);
 	}
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #ifdef _KERNEL
 	if (error == 0) {
 		for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
@@ -2164,7 +2164,7 @@ static int
 dsl_dataset_rename_snapshot_sync_impl(dsl_pool_t *dp,
 dsl_dataset_t *hds, void *arg)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #ifdef _KERNEL
 	char *oldname, *newname;
 #endif
@@ -2197,7 +2197,7 @@ dsl_dataset_rename_snapshot_sync_impl(ds
 	dsl_dataset_phys(hds)->ds_snapnames_zapobj,
 	ds->ds_snapname, 8, 1, >ds_object, tx));
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #ifdef _KERNEL
 	oldname = kmem_alloc(MAXPATHLEN, KM_SLEEP);
 	newname = kmem_alloc(MAXPATHLEN, KM_SLEEP);
@@ -2640,7 +2640,7 @@ dsl_dataset_promote_sync(void *arg, dmu_
 	dsl_dir_t *odd = NULL;
 	uint64_t oldnext_obj;
 	int64_t delta;
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(_KERNEL)
 	char *oldname, *newname;
 #endif
 
@@ -2710,7 +2710,7 @@ dsl_dataset_promote_sync(void *arg, dmu_
 		dsl_dir_phys(dd)->dd_clones, origin_head->ds_object, tx));
 	}
 
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(_KERNEL)
 	/* Take the spa_namespace_lock early so zvol renames don't deadlock. */
 	mutex_enter(_namespace_lock);
 
@@ -2752,7 +2752,7 @@ dsl_dataset_promote_sync(void *arg, dmu_
 		VERIFY0(dsl_dir_hold_obj(dp, dd->dd_object,
 		NULL, ds, >ds_dir));
 
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(_KERNEL)
 		dsl_dataset_name(ds, newname);
 		zfsvfs_update_fromname(oldname, newname);
 		zvol_rename_minors(oldname, newname);

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c:1.3
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c:1.2	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c	Wed May 22 08:45:32 2019
@@ -1912,7 +1912,7 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t 
 	VERIFY0(zap_add(mos, dsl_dir_phys(newparent)->dd_child_dir_zapobj,
 	dd->dd_myname, 8, 1, >dd_object, tx));
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #ifdef _KERNEL
 	zfsvfs_update_fromname(ddra->ddra_oldname, ddra->ddra_newname);
 	zvol_rename_minors(ddra->ddra_oldname, ddra->ddra_newname);

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.8 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.9
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.8	Tue May  7 08:49:59 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c	Wed May 22 08:45:32 2019
@@ -3226,7 +3226,7 @@ spa_open_common(const char *pool, spa_t 
 		spa->spa_last_ubsync_txg = 0;
 		spa->spa_load_txg = 0;
 		mutex_exit(_namespace_lock);
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #ifdef _KERNEL
 		if (firstopen)
 			zvol_create_minors(spa->spa_name);
@@ -4508,7 +4508,7 @@ spa_import(const char *pool, nvlist_t *c
 
 	mutex_exit(_namespace_lock);
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || 

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

2012-10-16 Thread Alan Barrett

On Mon, 15 Oct 2012, Taylor R Campbell wrote:

@@ -796,7 +794,11 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod
if (zp_is_dir  !zfs_dirempty(zp)) {   /* dir not empty */
mutex_exit(zp-z_lock);
vn_vfsunlock(vp);
+#ifdef __NetBSD__  /* XXX Make our dumb tests happier...  */
+   return (ENOTEMPTY);
+#else
return (EEXIST);
+#endif
}


I'd suggest using ifdef ENOTEMPTY instead of ifdef __NetBSD__ here.

(And the log message did not mention this change.)

--apb (Alan Barrett)


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

2012-10-16 Thread Taylor R Campbell
   Date: Tue, 16 Oct 2012 09:47:32 +0200
   From: Alan Barrett a...@cequrux.com

   On Mon, 15 Oct 2012, Taylor R Campbell wrote:
   @@ -796,7 +794,11 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod
   if (zp_is_dir  !zfs_dirempty(zp)) {   /* dir not empty */
   mutex_exit(zp-z_lock);
   vn_vfsunlock(vp);
   +#ifdef __NetBSD__  /* XXX Make our dumb tests happier...  */
   +   return (ENOTEMPTY);
   +#else
   return (EEXIST);
   +#endif
   }

   I'd suggest using ifdef ENOTEMPTY instead of ifdef __NetBSD__ here.

Well, both NetBSD and Solaris have ENOTEMPTY -- it's in POSIX.  POSIX
says that rmdir and rename can return either ENOTEMPTY or EEXIST.
It's just that all our other file systems return ENOTEMPTY in this
case.

   (And the log message did not mention this change.)

Oops, sorry -- that change was supposed to go in a separate commit.
Should I change the commit message with `cvs admin', or revert the
change and fix the tests instead, or do something else altogether?


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

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

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

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

Pasted the wrong commit message here.  Fixed now with `cvs admin'.
Sorry for the confusion!


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

2010-03-01 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Mon Mar  1 20:38:19 UTC 2010

Removed Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: fletcher.c

Log Message:
Remove fletcher.c from dist it was moved to common/zfs/zfs_fletcher.c in 
upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/fletcher.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

2010-01-11 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Mon Jan 11 12:10:19 UTC 2010

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

Log Message:
Replace VATTR_NULL() with vattr_null(). The ZFS module can be loaded
again now.


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

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



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

2010-01-09 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Sun Jan 10 01:35:39 UTC 2010

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

Log Message:
Fix problem in ZFS ZIL layer where unclean shutdown of filesystem can change
replayed file permissions to 777. Patch from FreeBSD. Original commit message:

Be careful which vattr fields are set during setattr replay.
Without this fix strange things can appear after unclean shutdown like
files with mode set to 0.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.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

2009-10-30 Thread Adam Hamsik


On Oct,Friday 30 2009, at 12:25 AM, Bill Stouder-Studenmund wrote:


On Thu, Oct 29, 2009 at 11:58:32PM +0100, Adam Hamsik wrote:


On Oct,Thursday 29 2009, at 8:15 PM, David Laight wrote:


On Wed, Oct 28, 2009 at 11:44:51PM +, Adam Hamsik wrote:

Module Name:src
Committed By:   haad
Date:   Wed Oct 28 23:44:51 UTC 2009

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

Log Message:
Add workaround about zfs vnode reclaiming deadlock by checking if
we don't
ehld ZFS_MUTEX_OBJ already. If we can lock OBJ_MUTEX deffer
execution of
zfs_zinactive to taskq. Code was inspired by FreeBSD
zfs_freebsd_reclaim.


This doesn't sound right at all ...

If the 'If we can lock OBJ_MUTEX' test is a try_mutex_enter() then
it may fail because another lwp owns it ...
I hope it is only the checkin comment that is inverted!


There are 3 option which can happen

1) Our lwp already holds mutex
2) mutex is not held at all
3) Another LWP holds it

In case 1 we can call reclaim vnode, in case 2 we lock it with
try_mutex_enter and reclaim it and in case 3 we use taskq for
reclaiming of vnode.


This is reclaiming in response to someone trying to get a cleaned  
vnode,
correct? If so, we should just change the reclaim API and return  
something
like EBUSY. If it's just cleaning to clean, then having a taskq do  
it is

fine.


That can be done but ti will require to change all fses +  
getcleanvnode because currently when it can't clean vnode it panics.



Where you able to look at the repository at macosforge.org before it  
shut

down? I think that would show a take at solving similar issues.


Yeah I have it somewhere around here, but as I noted I used freebsd  
version as a working example for this patch.



Regards

Adam.



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

2009-10-30 Thread Bill Stouder-Studenmund
On Fri, Oct 30, 2009 at 08:32:30AM +0100, Adam Hamsik wrote:
 
 On Oct,Friday 30 2009, at 12:25 AM, Bill Stouder-Studenmund wrote:
 
 On Thu, Oct 29, 2009 at 11:58:32PM +0100, Adam Hamsik wrote:
 
 On Oct,Thursday 29 2009, at 8:15 PM, David Laight wrote:
 
 On Wed, Oct 28, 2009 at 11:44:51PM +, Adam Hamsik wrote:
 Module Name:  src
 Committed By: haad
 Date: Wed Oct 28 23:44:51 UTC 2009
 
 Modified Files:
   src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
 zfs_znode.c
 
 Log Message:
 Add workaround about zfs vnode reclaiming deadlock by checking if
 we don't
 ehld ZFS_MUTEX_OBJ already. If we can lock OBJ_MUTEX deffer
 execution of
 zfs_zinactive to taskq. Code was inspired by FreeBSD
 zfs_freebsd_reclaim.
 
 This doesn't sound right at all ...
 
 If the 'If we can lock OBJ_MUTEX' test is a try_mutex_enter() then
 it may fail because another lwp owns it ...
 I hope it is only the checkin comment that is inverted!
 
 There are 3 option which can happen
 
 1) Our lwp already holds mutex
 2) mutex is not held at all
 3) Another LWP holds it
 
 In case 1 we can call reclaim vnode, in case 2 we lock it with
 try_mutex_enter and reclaim it and in case 3 we use taskq for
 reclaiming of vnode.
 
 This is reclaiming in response to someone trying to get a cleaned  
 vnode,
 correct? If so, we should just change the reclaim API and return  
 something
 like EBUSY. If it's just cleaning to clean, then having a taskq do  
 it is
 fine.
 
 That can be done but ti will require to change all fses +  
 getcleanvnode because currently when it can't clean vnode it panics.

Yes, you have to change getcleanvnode, but why do the file systems need to 
change? That's making this harder than it has to be.

Pick an error value. I now thing EDEADLK is best, since it describes 
what's going on. Make getcleanvnode just skip to the next one in the list 
if it gets this error value back. Let it panic otherwise.

The only thing you need to do with other file systems is make sure their 
reclaim doesn't report EDEADLK when the code really wants to panic the 
kernel. Since we don't hear a lot about panicing while getting new vnodes 
(other than this bug), I think you're safe.

Take care,

Bill


pgp3IEtVj3AHx.pgp
Description: PGP signature


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

2009-10-29 Thread David Laight
On Wed, Oct 28, 2009 at 11:44:51PM +, Adam Hamsik wrote:
 Module Name:  src
 Committed By: haad
 Date: Wed Oct 28 23:44:51 UTC 2009
 
 Modified Files:
   src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c zfs_znode.c
 
 Log Message:
 Add workaround about zfs vnode reclaiming deadlock by checking if we don't
 ehld ZFS_MUTEX_OBJ already. If we can lock OBJ_MUTEX deffer execution of
 zfs_zinactive to taskq. Code was inspired by FreeBSD zfs_freebsd_reclaim.

This doesn't sound right at all ...

If the 'If we can lock OBJ_MUTEX' test is a try_mutex_enter() then
it may fail because another lwp owns it ...
I hope it is only the checkin comment that is inverted!

David

-- 
David Laight: da...@l8s.co.uk


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

2009-10-29 Thread Adam Hamsik


On Oct,Thursday 29 2009, at 8:15 PM, David Laight wrote:


On Wed, Oct 28, 2009 at 11:44:51PM +, Adam Hamsik wrote:

Module Name:src
Committed By:   haad
Date:   Wed Oct 28 23:44:51 UTC 2009

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


Log Message:
Add workaround about zfs vnode reclaiming deadlock by checking if  
we don't
ehld ZFS_MUTEX_OBJ already. If we can lock OBJ_MUTEX deffer  
execution of
zfs_zinactive to taskq. Code was inspired by FreeBSD  
zfs_freebsd_reclaim.


This doesn't sound right at all ...

If the 'If we can lock OBJ_MUTEX' test is a try_mutex_enter() then
it may fail because another lwp owns it ...
I hope it is only the checkin comment that is inverted!


There are 3 option which can happen

1) Our lwp already holds mutex
2) mutex is not held at all
3) Another LWP holds it

In case 1 we can call reclaim vnode, in case 2 we lock it with  
try_mutex_enter and reclaim it and in case 3 we use taskq for  
reclaiming of vnode.

Regards

Adam.



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

2009-10-29 Thread Bill Stouder-Studenmund
On Thu, Oct 29, 2009 at 11:58:32PM +0100, Adam Hamsik wrote:
 
 On Oct,Thursday 29 2009, at 8:15 PM, David Laight wrote:
 
 On Wed, Oct 28, 2009 at 11:44:51PM +, Adam Hamsik wrote:
 Module Name:src
 Committed By:   haad
 Date:   Wed Oct 28 23:44:51 UTC 2009
 
 Modified Files:
 src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c  
 zfs_znode.c
 
 Log Message:
 Add workaround about zfs vnode reclaiming deadlock by checking if  
 we don't
 ehld ZFS_MUTEX_OBJ already. If we can lock OBJ_MUTEX deffer  
 execution of
 zfs_zinactive to taskq. Code was inspired by FreeBSD  
 zfs_freebsd_reclaim.
 
 This doesn't sound right at all ...
 
 If the 'If we can lock OBJ_MUTEX' test is a try_mutex_enter() then
 it may fail because another lwp owns it ...
 I hope it is only the checkin comment that is inverted!
 
 There are 3 option which can happen
 
 1) Our lwp already holds mutex
 2) mutex is not held at all
 3) Another LWP holds it
 
 In case 1 we can call reclaim vnode, in case 2 we lock it with  
 try_mutex_enter and reclaim it and in case 3 we use taskq for  
 reclaiming of vnode.

This is reclaiming in response to someone trying to get a cleaned vnode, 
correct? If so, we should just change the reclaim API and return something 
like EBUSY. If it's just cleaning to clean, then having a taskq do it is 
fine.

Where you able to look at the repository at macosforge.org before it shut 
down? I think that would show a take at solving similar issues.

Take care,

Bill


pgpKqLrLUhuOJ.pgp
Description: PGP signature


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

2009-10-29 Thread Jason Thorpe

On Oct 29, 2009, at 4:25 PM, Bill Stouder-Studenmund wrote:

 Where you able to look at the repository at macosforge.org before it shut 
 down? I think that would show a take at solving similar issues.

Note that the XNU vnode lifecycle, referencing, and locking implementation is 
significantly different from ours.

-- thorpej