]> git.proxmox.com Git - mirror_spl.git/log
mirror_spl.git
5 years agoTag spl-0.7.13 spl-0.7-release spl-0.7.13
Tony Hutter [Fri, 22 Feb 2019 17:47:34 +0000 (09:47 -0800)]
Tag spl-0.7.13

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoLinux 4.20 compat: Fix current_kernel_time()
Tony Hutter [Tue, 29 Jan 2019 05:09:28 +0000 (21:09 -0800)]
Linux 4.20 compat: Fix current_kernel_time()

current_kernel_time() is no longer provided in the 4.20 kernel.
Add a shim that calls the correct "get current time" function.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoLinux 5.0 compat: Fix timespec_sub()
Tony Hutter [Tue, 29 Jan 2019 02:44:14 +0000 (18:44 -0800)]
Linux 5.0 compat: Fix timespec_sub()

The 5.0 kernel no longer include timespec_sub().  It only has
timespec64_sub().  Add a compatibility function.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>

5 years agoLinux 5.0 compat: Fix SUBDIRs
Tony Hutter [Tue, 29 Jan 2019 00:58:43 +0000 (16:58 -0800)]
Linux 5.0 compat: Fix SUBDIRs

(This is the SPL port of this patch)

SUBDIRs has been deprecated for a long time, and was finally removed in
the 5.0 kernel.  Use "M=" instead.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8257

5 years agoLinux 5.0 compat: Use totalram_pages()
Tony Hutter [Fri, 18 Jan 2019 21:28:49 +0000 (13:28 -0800)]
Linux 5.0 compat: Use totalram_pages()

(This is the ported SPL part of this patch)

totalram_pages() was converted to an atomic variable in 5.0:

https://patchwork.kernel.org/patch/10652795/

Its value should now be read though the totalram_pages() helper
function.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8263

5 years agodeadlock between mm_sem and tx assign in zfs_write() and page fault
Tony Hutter [Fri, 18 Jan 2019 18:05:58 +0000 (10:05 -0800)]
deadlock between mm_sem and tx assign in zfs_write() and page fault

(This is the ported SPL portion of this patch)

The bug time sequence:
1. thread #1, `zfs_write` assign a txg "n".
2. In a same process, thread #2, mmap page fault (which means the
`mm_sem` is hold) occurred, `zfs_dirty_inode` open a txg failed,
and wait previous txg "n" completed.
3. thread #1 call `uiomove` to write, however page fault is occurred
in `uiomove`, which means it need `mm_sem`, but `mm_sem` is hold by
thread #2, so it stuck and can't complete,  then txg "n" will
not complete.

So thread #1 and thread #2 are deadlocked.

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Grady Wong <grady.w@xtaotech.com>
Closes #7939

5 years agoLinux 4.18 compat: Use ktime_get_coarse_real_ts64()
Tony Hutter [Fri, 18 Jan 2019 17:57:34 +0000 (09:57 -0800)]
Linux 4.18 compat: Use ktime_get_coarse_real_ts64()

(This is the ported SPL version of this patch)

Newer kernels remove current_kernel_time64().  Use
ktime_get_coarse_real_ts64() in its place.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8258

5 years agoUse autoconf variable for C preprocessor
Ben Wolsieffer [Mon, 3 Dec 2018 22:31:06 +0000 (17:31 -0500)]
Use autoconf variable for C preprocessor

This fixes the build when cross-compiling, where the preprocessor might
be prefixed.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
5 years agoTag spl-0.7.12 spl-0.7.12
Tony Hutter [Thu, 8 Nov 2018 22:38:28 +0000 (14:38 -0800)]
Tag spl-0.7.12

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoAdd BuildRequires gcc, make, elfutils-libelf-devel
Tony Hutter [Thu, 8 Nov 2018 06:13:20 +0000 (22:13 -0800)]
Add BuildRequires gcc, make, elfutils-libelf-devel

This adds a BuildRequires for gcc, make, and elfutils-libelf-devel
into our spec files.  gcc has been a packaging requirement for
awhile now:

https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B

These additional BuildRequires allow us to mock build in
Fedora 29.

(This is the backported SPL equivalent of the original ZFS patch)

Reviewed-by: Neal Gompa <ngompa@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8095
Closes #8102

5 years agoLinux 4.20 compat: current_kernel_time()
Tony Hutter [Thu, 25 Oct 2018 05:42:14 +0000 (22:42 -0700)]
Linux 4.20 compat: current_kernel_time()

Commit torvalds/linux@976516404 removed the current_kernel_time()
function (and several others).  All callers are expected to use
current_kernel_time64().  Update the gethrestime_sec() wrapper
accordingly.

Backported to SPL from zfs:82c0a050f

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8074

5 years agoBackport vnode.h changes from zfs:93ce2b4c
Tony Hutter [Fri, 26 Oct 2018 10:51:38 +0000 (06:51 -0400)]
Backport vnode.h changes from zfs:93ce2b4c

This backports the vnode.h changes from zfs:93ce2b4c for zfs-0.7.12.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoDefine timestruc_t for Lustre compatibility
Tony Hutter [Fri, 26 Oct 2018 05:24:24 +0000 (01:24 -0400)]
Define timestruc_t for Lustre compatibility

Lustre 2.8 (and possibly other versions) are still using timestruc_t,
which was removed in spl-0.7.10 in favor of inode_timespec_t.  Add
in a backwards compatibility #define for timestruc_t so that Lustre
builds.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8014

5 years agoTag spl-0.7.11
Tony Hutter [Thu, 13 Sep 2018 17:13:33 +0000 (10:13 -0700)]
Tag spl-0.7.11

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoLinux 4.18 compat: Kconfig
Brian Behlendorf [Thu, 13 Sep 2018 00:42:34 +0000 (20:42 -0400)]
Linux 4.18 compat: Kconfig

The kernel's top level Kconfig was updated in 4.18 such that it
no longer matches the expected pattern preventing the spl source
from being inserted.  Simplify the existing logic to always insert
the entry at the end of the file since an exact location is not
required, unlike in the Makefile.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #7890

5 years agoTag spl-0.7.10
Tony Hutter [Wed, 5 Sep 2018 17:36:46 +0000 (10:36 -0700)]
Tag spl-0.7.10

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoAdd rwsem_tryupgrade for 4.9.20-rt16 kernel (SPL)
Tony Hutter [Wed, 15 Aug 2018 18:58:54 +0000 (11:58 -0700)]
Add rwsem_tryupgrade for 4.9.20-rt16 kernel (SPL)

(This is the SPL backported code from 11d0525cb)

The RT rwsem implementation was changed to allow multiple readers
as of the 4.9.20-rt16 patch set.  This results in a build failure
because the existing implementation was forced to directly access
the rwsem structure which has changed.

While this could be accommodated by adding additional compatibility
code.  This patch resolves the build issue by simply assuming the
rwsem can never be upgraded.  This functionality is a performance
optimization and all callers must already handle this case.

Converting the last remaining use of __SPIN_LOCK_UNLOCKED to
spin_lock_init() was additionally required to get a clean build.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7589

5 years agoAdd pool state /proc entry, "SUSPENDED" pools (SPL)
Tony Hutter [Wed, 15 Aug 2018 16:39:55 +0000 (09:39 -0700)]
Add pool state /proc entry, "SUSPENDED" pools (SPL)

(This is the SPL backported code from f0ed6c744)

1. Add a proc entry to display the pool's state:

$ cat /proc/spl/kstat/zfs/tank/state
ONLINE

This is done without using the spa config locks, so it will
never hang.

2. Fix 'zpool status' and 'zpool list -o health' output to print
"SUSPENDED" instead of "ONLINE" for suspended pools.

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #7331
Closes #7563

5 years agoLinux 4.18 compat: inode timespec -> timespec64
Brian Behlendorf [Sun, 12 Aug 2018 22:22:54 +0000 (18:22 -0400)]
Linux 4.18 compat: inode timespec -> timespec64

Commit torvalds/linux@95582b0 changes the inode i_atime, i_mtime,
and i_ctime members form timespec's to timespec64's to make them
2038 safe.  As part of this change the current_time() function was
also updated to return the timespec64 type.

Resolve this issue by introducing a new inode_timespec_t type which
is defined to match the timespec type used by the inode.  It should
be used when working with inode timestamps to ensure matching types.

The timestruc_t type under Illumos was used in a similar fashion but
was specified to always be a timespec_t.  Rather than incorrectly
define this type all timespec_t types have been replaced by the new
inode_timespec_t type.

Finally, the kernel and user space 'sys/time.h' headers were aligned
with each other.  They define as appropriate for the context several
constants as macros and include static inline implementation of
gethrestime(), gethrestime_sec(), and gethrtime().

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7643
Backported-by: Richard Yao <ryao@gentoo.org>
5 years agoTag spl-0.7.9
Tony Hutter [Tue, 8 May 2018 20:33:32 +0000 (13:33 -0700)]
Tag spl-0.7.9

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
5 years agoFix undefined RPM macros
Brian Behlendorf [Wed, 2 May 2018 22:34:20 +0000 (15:34 -0700)]
Fix undefined RPM macros

Always invoke the SPL_AC_DEBUG* macro's when running configure
so RPM_DEFINE_COMMON is correctly expanded.  A similar change
was already applied to ZFS.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #703

5 years agoExclude python scripts from RPM shebang check
Tony Hutter [Mon, 16 Apr 2018 22:40:14 +0000 (15:40 -0700)]
Exclude python scripts from RPM shebang check

The newest Fedora packaging rules print warnings for scripts using the
/usr/bin/python shebang:

  *** WARNING: mangling shebang in /usr/src/spl-0.7.0/cmd/splslab/splslab.py
  from #!/usr/bin/python to #!/usr/bin/python2. This will become an ERROR,
  fix it manually!

Fedora wants all cross compatible scripts to pick python3.  Since we
don't want our users to have to pick a specific version of python, we
exclude our scripts from the RPM build check.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes: #699
Closes: #700
5 years agoLinux compat 4.16: SECTOR_SIZE
Giuseppe Di Natale [Tue, 10 Apr 2018 00:20:06 +0000 (17:20 -0700)]
Linux compat 4.16: SECTOR_SIZE

As of https://github.com/torvalds/linux/commit/233bde21,
SECTOR_SIZE is defined in linux/blkdev.h. Define SECTOR_SIZE
in sunldi.h only if it's not already defined.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #697

5 years agoRemove sysevents
Brian Behlendorf [Wed, 4 Apr 2018 16:54:20 +0000 (09:54 -0700)]
Remove sysevents

These headers are provided in the ZFS repository and never used
by the SPL.  Remove them to ensure the right ones are included.

Reviewed-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #696

6 years agoTag spl-0.7.8
Tony Hutter [Mon, 9 Apr 2018 21:31:47 +0000 (14:31 -0700)]
Tag spl-0.7.8

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoTag spl-0.7.7
Tony Hutter [Wed, 14 Mar 2018 23:16:00 +0000 (16:16 -0700)]
Tag spl-0.7.7

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoFix spl-kmod builds when using rpm >= 4.14
LOLi [Fri, 9 Mar 2018 21:51:31 +0000 (22:51 +0100)]
Fix spl-kmod builds when using rpm >= 4.14

With rpm-software-management/rpm@5e94633 a package version containing
invalid characters (most commonly a double '-') causes the kmod package
generation to terminate with an error.  This change takes advantage of
the newly introduced rpm macro "_wrong_version_format_terminate_build"
to allow kmod packages to be built.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #691

6 years agoFix more cstyle warnings
Brian Behlendorf [Sat, 24 Feb 2018 18:05:37 +0000 (10:05 -0800)]
Fix more cstyle warnings

This patch contains no functional changes.  It is solely intended
to resolve cstyle warnings in order to facilitate moving the spl
source code in to the zfs repository.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #687

6 years agoFix function name typos
Tomohiro Kusumi [Mon, 19 Feb 2018 11:40:38 +0000 (20:40 +0900)]
Fix function name typos

vn_init() and vn_fini() had been renamed by 12ff95ff in 2011.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes #686

6 years agoStaticize kstat_default_update()
Tomohiro Kusumi [Mon, 19 Feb 2018 10:23:53 +0000 (19:23 +0900)]
Staticize kstat_default_update()

This is only used via ->ks_update of `kstat_t *`.
This isn't exported nor do headers have its prototype.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes #686

6 years agoFix multiple evaluations of VERIFY() and ASSERT() on failures
DeHackEd [Wed, 21 Feb 2018 22:54:26 +0000 (17:54 -0500)]
Fix multiple evaluations of VERIFY() and ASSERT() on failures

Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: DHE <git@dehacked.net>
Closes #684
Closes #685

6 years agoSplit spl-build.m4
Brian Behlendorf [Wed, 7 Feb 2018 19:50:24 +0000 (11:50 -0800)]
Split spl-build.m4

Split the kernel interface configure checks in to seperate m4
macro files.  This is intended to facilitate moving the spl
source code in to the zfs repository.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #682

6 years agoFix cstyle warnings
Brian Behlendorf [Wed, 7 Feb 2018 19:49:38 +0000 (11:49 -0800)]
Fix cstyle warnings

This patch contains no functional changes.  It is solely intended
to resolve cstyle warnings in order to facilitate moving the spl
source code in to the zfs repository.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #681

6 years agoAdd cv_timedwait_io()
Brian Behlendorf [Wed, 24 Jan 2018 19:33:47 +0000 (11:33 -0800)]
Add cv_timedwait_io()

Add missing helper function cv_timedwait_io(), it should be used
when waiting on IO with a specified timeout.

Reviewed-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #674

6 years agoRemove all spin_is_locked calls
James Cowgill [Mon, 30 Oct 2017 18:16:56 +0000 (18:16 +0000)]
Remove all spin_is_locked calls

On systems with CONFIG_SMP turned off, spin_is_locked always returns
false causing these assertions to fail. Remove them as suggested in
zfsonlinux/zfs#6558.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: James Cowgill <james.cowgill@mips.com>
Closes #665

6 years agoRemove vn_rename and vn_remove
Brian Behlendorf [Fri, 27 Oct 2017 22:49:14 +0000 (15:49 -0700)]
Remove vn_rename and vn_remove

Both vn_rename and vn_remove have been historically problematic
to implement reliably.  Rather than fixing them yet again they
are being removed.

Reviewed-by: Arkadiusz Bubala <arkadiusz.bubala@open-e.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #648
Closes #661

6 years agoAllow longer SPA names in stats
gaurkuma [Fri, 11 Aug 2017 15:53:35 +0000 (08:53 -0700)]
Allow longer SPA names in stats

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: gaurkuma <gauravk.18@gmail.com>
Closes #641

6 years agoTag spl-0.7.6
Tony Hutter [Thu, 1 Feb 2018 18:02:27 +0000 (10:02 -0800)]
Tag spl-0.7.6

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoFix Debian packaging on ARMv7/ARM64
LOLi [Thu, 18 Jan 2018 18:14:18 +0000 (19:14 +0100)]
Fix Debian packaging on ARMv7/ARM64

When building packages on Debian-based systems specify the target
architecture used by 'alien' to convert .rpm packages into .deb: this
avoids detecting an incorrect value which results in the following
errors:

<package>.aarch64.rpm is for architecture aarch64 ; the package cannot be built on this system
<package>.armv7l.rpm is for architecture armel ; the package cannot be built on this system

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes zfsonlinux/zfs#7046
Closes #678

6 years agoLinux 4.15 compat: timer updates
Tony Hutter [Thu, 21 Dec 2017 18:56:32 +0000 (10:56 -0800)]
Linux 4.15 compat: timer updates

Use timer_setup() macro and new timeout function definition.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #670
Closes #671

6 years agoTag spl-0.7.5
Tony Hutter [Mon, 18 Dec 2017 18:57:33 +0000 (10:57 -0800)]
Tag spl-0.7.5

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoTag spl-0.7.4
Tony Hutter [Thu, 7 Dec 2017 18:25:28 +0000 (10:25 -0800)]
Tag spl-0.7.4

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoLinux 4.14 compat: vfs_read & vfs_write
Brian Behlendorf [Thu, 16 Nov 2017 01:19:23 +0000 (17:19 -0800)]
Linux 4.14 compat: vfs_read & vfs_write

The kernel_read & kernel_write functions have always wrapped the
vfs_read & vfs_write functions respectively.  However, they could
not be used by vn_rdwr() since the offset wasn't passed as a
pointer.  This prevented us from being able to properly update
the file offset.

Linux 4.14 unexported vfs_read & vfs_write but also changed the
signature of kernel_read & kernel_write to provide the needed
functionality.  Use these updated functions when available.

Reviewed-by: Pritam Baral <pritam@pritambaral.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #656
Closes #667

6 years agoUpdate spl module parameters man5 with missing parameter details
abraunegg [Fri, 27 Oct 2017 22:46:34 +0000 (09:46 +1100)]
Update spl module parameters man5 with missing parameter details

Update spl module parameters man5 with the following missing parameter
details for spl_panic_halt.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alex Braunegg <alex.braunegg@gmail.com>
Closes #664

6 years agoPool io stat shows wlentime instead of rlentime
Richard Elling [Mon, 25 Sep 2017 17:02:24 +0000 (10:02 -0700)]
Pool io stat shows wlentime instead of rlentime

Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Elling <Richard.Elling@RichardElling.com>
Closes #652
Closes #651

6 years agospl-module-parameters.5 manpage: fix macro
Fabian-Gruenbichler [Thu, 10 Aug 2017 22:22:31 +0000 (00:22 +0200)]
spl-module-parameters.5 manpage: fix macro

There is no '.sh' macro in troff/groff/man, only '.SH' for section
headers. I assume .sp for a line break was intended here like
in the rest of the man page.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #643

6 years agosplat.1 manpage: fix spelling of 'hexadecimal'
Fabian-Gruenbichler [Thu, 10 Aug 2017 22:21:54 +0000 (00:21 +0200)]
splat.1 manpage: fix spelling of 'hexadecimal'

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #642

6 years agoFix use-after-free in taskq_seq_show_impl
Chunwei Chen [Fri, 4 Aug 2017 16:57:58 +0000 (09:57 -0700)]
Fix use-after-free in taskq_seq_show_impl

taskq_seq_show_impl walks the tq_active_list to show the tqent_func and
tqent_arg. However for taskq_dispatch_ent, it's very likely that the
task entry will be freed during the function call, and causes a
use-after-free bug.

To fix this, we duplicate the task entry to an on-stack struct, and
assign it instead to tqt_task. This way, the tq_lock alone will
guarantee its safety.

Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #638
Closes #640

6 years agoTag spl-0.7.3
Tony Hutter [Wed, 18 Oct 2017 17:59:35 +0000 (10:59 -0700)]
Tag spl-0.7.3

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoAdd DKMS package on Debian-based distributions
Neal Gompa (ニール・ゴンパ) [Sun, 15 Oct 2017 19:58:12 +0000 (15:58 -0400)]
Add DKMS package on Debian-based distributions

* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/spl-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Requires to RPM distros
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes #657

6 years agoAdd parenthesis to btop and ptob macros (#662)
Antonio Russo [Fri, 13 Oct 2017 17:50:45 +0000 (13:50 -0400)]
Add parenthesis to btop and ptob macros (#662)

Add missing parenthesis around btop and ptob macros to ensure
operation ordering is preserved after expansion.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #660

6 years agoTag spl-0.7.2
Tony Hutter [Thu, 21 Sep 2017 20:37:20 +0000 (13:37 -0700)]
Tag spl-0.7.2

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoTag spl-0.7.1
Tony Hutter [Tue, 8 Aug 2017 20:09:41 +0000 (13:09 -0700)]
Tag spl-0.7.1

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
6 years agoAdd assert under lock to detect cases of dispach of a preallocated
Boris Protopopov [Tue, 8 Aug 2017 15:31:52 +0000 (11:31 -0400)]
Add assert under lock to detect cases of dispach of a preallocated

taskq work item to more than one queue concurrently. Also, please
see discussion in zfsonlinux/zfs#3840.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Boris Protopopov <boris.protopopov@actifio.com>
Closes #609

6 years agoRemove misguided HAVE_MUTEX_OWNER check, take 2
Oleg Drokin [Wed, 2 Aug 2017 18:45:16 +0000 (14:45 -0400)]
Remove misguided HAVE_MUTEX_OWNER check, take 2

It is just plain unsafe to peek inside in-kernel
mutex structure and make assumptions about what kernel
does with those internal fields like owner.

Kernel is all too happy to stop doing the expected things
like tracing lock owner once you load a tainted module
like spl/zfs that is not GPL.

As such you will get instant assertion failures like this:

  VERIFY3(((*(volatile typeof((&((&zo->zo_lock)->m_mutex))->owner) *)&
      ((&((&zo->zo_lock)->m_mutex))->owner))) ==
     ((void *)0)) failed (ffff88030be28500 == (null))
  PANIC at zfs_onexit.c:104:zfs_onexit_destroy()
  Showing stack for process 3626
  CPU: 0 PID: 3626 Comm: mkfs.lustre Tainted: P OE ------------ 3.10.0-debug #1
  Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
  Call Trace:
  dump_stack+0x19/0x1b
  spl_dumpstack+0x44/0x50 [spl]
  spl_panic+0xbf/0xf0 [spl]
  zfs_onexit_destroy+0x17c/0x280 [zfs]
  zfsdev_release+0x48/0xd0 [zfs]

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Gvozden Neskovic <neskovic@gmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Closes #639
Closes #632

6 years agospl-mutex: fix race in mutex_exit
Gvozden Neskovic [Thu, 3 Aug 2017 03:42:58 +0000 (05:42 +0200)]
spl-mutex: fix race in mutex_exit

Prevent race on accessing kmutex_t when the mutex is
embedded in a ref counted structure.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Closes zfsonlinux/zfs#6401
Closes #637

6 years agoAdd __divmoddi4 and __udivmoddi4 for 32-bit arch
Chunwei Chen [Thu, 3 Aug 2017 17:41:42 +0000 (10:41 -0700)]
Add __divmoddi4 and __udivmoddi4 for 32-bit arch

gcc-7 seems to use __udivmoddi4 for 64-bit division on 32-bit arch. This
patch implement them so we don't get undefined reference error.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes zfsonlinux/zfs#6417
Closes #636

6 years agoFix aarch64 build
Brian Behlendorf [Sat, 29 Jul 2017 20:24:39 +0000 (13:24 -0700)]
Fix aarch64 build

Add aarch64 to the list of architecture which do not sanitize the
LDFLAGS from the environment.  See e0aacd9b for details.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #635

6 years agoTag spl-0.7.0
Brian Behlendorf [Wed, 26 Jul 2017 17:08:57 +0000 (10:08 -0700)]
Tag spl-0.7.0

META file and changelog updated.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
6 years agoModule parameter to enable spl_panic() to panic the kernel
Oleg Drokin [Wed, 26 Jul 2017 06:03:12 +0000 (02:03 -0400)]
Module parameter to enable spl_panic() to panic the kernel

In unattended operations it's often more useful to have node
panic and reboot when it encounters problems as opposed to
sit there indefinitely waiting for somebody to discover it.

This implements an spl_panic_crash module parameter, set it
to nonzero to cause spl_panic() to call panic().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Closes #634

6 years agoAvoid WARN() from procfs on kstat collision
LOLi [Mon, 24 Jul 2017 17:52:53 +0000 (19:52 +0200)]
Avoid WARN() from procfs on kstat collision

When we load a ZFS pool having spa_name equals to some existing kstat
we would have to create a duplicate entry, which procfs doesn't like.

For instance a ZFS pool named "zil" would have its kstat "txgs"
(module "zfs/zil") intalled under "/proc/spl/kstat/zfs/zil":
unfortunately we already have a kstat named "zil" (module "zfs")
installed in the same procfs location.

Avoid this issue by skipping the duplicate entry creation in procfs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #628

6 years agoLinux 4.13 compat: wait queues
Brian Behlendorf [Mon, 24 Jul 2017 02:32:14 +0000 (19:32 -0700)]
Linux 4.13 compat: wait queues

Commit torvalds/linux@ac6424b9
- Renamed struct wait_queue -> struct wait_queue_entry.

Commit torvalds/linux@2055da97
- Renamed wait_queue_head::task_list -> wait_queue_head::head
- Renamed wait_queue_entry::task_list -> wait_queue_entry::entry

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #629

6 years agoTag 0.7.0-rc5
Brian Behlendorf [Thu, 13 Jul 2017 19:07:59 +0000 (12:07 -0700)]
Tag 0.7.0-rc5

Fifth release candidate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
6 years agoDon't cache the system hostid
Brian Behlendorf [Mon, 10 Jul 2017 19:24:52 +0000 (15:24 -0400)]
Don't cache the system hostid

Historically the SPL cached the system hostid the first time it
was accessed.  This was done to speed up subsequent accesses.
But in practice the system host id is rarely accessed and its
inconvenient that it doesn't promptly detect /etc/hostid
configuration changes.  Therefore, zone_get_hostid() has been
updated to always refresh the system hostid reported.

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #626

6 years agoAdd ASSERT3B/VERIFY3B/USEC2NSEC/NSEC2USEC macros
Prakash Surya [Mon, 10 Jul 2017 19:44:23 +0000 (12:44 -0700)]
Add ASSERT3B/VERIFY3B/USEC2NSEC/NSEC2USEC macros

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Prakash Surya <prakash.surya@delphix.com>
Closes #627

6 years agoFix RWSEM_SPINLOCK_IS_RAW check failed
Chunwei Chen [Mon, 19 Jun 2017 18:02:20 +0000 (11:02 -0700)]
Fix RWSEM_SPINLOCK_IS_RAW check failed

Initialize dummy_lock to fix the build error in gcc 7.1.1 with:
  error: ‘dummy_lock’ is used uninitialized in this function

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #622

6 years agoconfig: allow --with-linux without --with-linux-obj
Chunwei Chen [Wed, 24 May 2017 22:42:34 +0000 (15:42 -0700)]
config: allow --with-linux without --with-linux-obj

Don't use `uname -r` to determine kernel build directory when the user
specified kernel source with --with-linux. Otherwise, the user is forced
to use --with-linux-obj even if they are the same directory, which is
very counterintuitive.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
6 years agoImprove gitignore
Chunwei Chen [Wed, 24 May 2017 22:23:37 +0000 (15:23 -0700)]
Improve gitignore

Exclude Makefile.in in module/ and fix the gitignore in cmd/
Also, ignore *.patch and *.orig files

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
6 years agoFix cv_timedwait timeout
Brian Behlendorf [Thu, 25 May 2017 17:01:44 +0000 (10:01 -0700)]
Fix cv_timedwait timeout

Perform the already past expiration time check before updating
cvp->cv_mutex with the provided mutex.  This check only depends
on local state.  Doing it first ensures that cvp->cv_mutex will not
be updated in the timeout case or if it's ever called with an
expire_time <= now.

Reviewed-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #616

6 years agoLinux 4.12 compat: PF_FSTRANS was removed
Chunwei Chen [Tue, 9 May 2017 17:36:54 +0000 (10:36 -0700)]
Linux 4.12 compat: PF_FSTRANS was removed

Change SPL_FSTRANS to optionally contains PF_FSTRANS. Also, add
__spl_pf_fstrans_check for the checks specifically for PF_FSTRANS.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #614

6 years agoTag 0.7.0-rc4
Brian Behlendorf [Fri, 5 May 2017 16:23:03 +0000 (09:23 -0700)]
Tag 0.7.0-rc4

Fourth release candidate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
7 years agoglibc 2.25 compat: remove assert(X=Y)
Olaf Faaland [Mon, 3 Apr 2017 20:33:49 +0000 (13:33 -0700)]
glibc 2.25 compat: remove assert(X=Y)

The assert() related definitions in glibc 2.25 were altered to warn
about assert(X=Y) when -Wparentheses is used.  See
https://abi-laboratory.pro/tracker/changelog/glibc/2.25/log.html

lib/list.c used this construct to set the value of a magic field which
is defined only when debugging.

Replaced the assert()s with #ifndef/#endifs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #610

7 years agoLinux 4.11 compat: remove stub for __put_task_struct
Olaf Faaland [Mon, 13 Mar 2017 17:37:10 +0000 (10:37 -0700)]
Linux 4.11 compat: remove stub for __put_task_struct

Before kernel 2.6.29 credentials were embedded in task_structs, and zfs had
cases where one thread would need to refer to the credential of another thread,
forcing it to take a hold on the foreign thread's task_struct to ensure it was
not freed.

Since 2.6.29, the credential has been moved out of the task_struct into a
cred_t.

In addition, the mainline kernel originally did not export __put_task_struct()
but the RHEL5 kernel did, according to zfsonlinux/spl@e811949a570.  As of
2.6.39 the mainline kernel exports it.

There is no longer zfs code that takes or releases holds on a task_struct, and
so there is no longer any reference to __put_task_struct().

This affects the linux 4.11 kernel because the prototype for
__put_task_struct() is in a new include file (linux/sched/task.h) and so the
config check failed to detect the exported symbol.

Removing the unnecessary stub and corresponding config check.  This works on
kernels since the oldest one currently supported, 2.6.32 as shipped with
Centos/RHEL.

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #608

7 years agoLinux 4.11 compat: add linux/sched/signal.h
Olaf Faaland [Tue, 7 Mar 2017 23:33:50 +0000 (15:33 -0800)]
Linux 4.11 compat: add linux/sched/signal.h

In Linux 4.11, torvalds/linux@2a1f062, signal handling related functions
were moved from sched.h into sched/signal.h.

Add configure checks to detect this and include the new file where
needed.

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #608

7 years agoLinux 4.11 compat: vfs_getattr() takes 4 args
Olaf Faaland [Tue, 7 Mar 2017 21:18:53 +0000 (13:18 -0800)]
Linux 4.11 compat: vfs_getattr() takes 4 args

There are changes to vfs_getattr() in torvalds/linux@a528d35.  The new
interface is:

int vfs_getattr(const struct path *path, struct kstat *stat,
               u32 request_mask, unsigned int query_flags)

The request_mask argument indicates which field(s) the caller intends to
use.  Fields the caller does not specify via request_mask may be set in
the returned struct anyway, but their values may be approximate.

The query_flags argument indicates whether the filesystem must update
the attributes from the backing store.

This patch uses the query_flags which result in vfs_getattr behaving the same
as it did with the 2-argument version which the kernel provided before
Linux 4.11.

Members blksize and blocks are now always the same size regardless of
arch.  They match the size of the equivalent members in vnode_t.

The configure checks are modified to ensure that the appropriate
vfs_getattr() interface is used.

A more complete fix, removing the ZFS dependency on vfs_getattr()
entirely, is deferred as it is a much larger project.

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #608

7 years agoFix powerpc build
Brian Behlendorf [Mon, 6 Mar 2017 17:16:22 +0000 (09:16 -0800)]
Fix powerpc build

Unlike other architectures which sanitize the LDFLAGS from the
environment in arch/<arch>/Makefile.  The powerpc Makefile
allows LDFLAGS to be passed through resulting in the following
build failure.

  /usr/bin/ld: unrecognized option '-Wl,-z,relro'

LDFLAGS is set in /usr/lib/rpm/redhat/macros by default.  Clear
the environment variable when building kmods for powerpc.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #607

7 years agoLinux 4.11 compat: set_task_state() removed
Olaf Faaland [Thu, 23 Feb 2017 17:52:08 +0000 (09:52 -0800)]
Linux 4.11 compat: set_task_state() removed

Replace uses of set_task_state(current, STATE) with
set_current_state(STATE).

In Linux 4.11, torvalds/linux@642fa44, set_task_state() is removed.

All spl uses are of the form set_task_state(current, STATE).
set_current_state(STATE) is equivalent and has been available since
Linux 2.2.26.

Furthermore, set_current_state(STATE) is already used in about 15
locations within spl.  This change should have no impact other than
removing an unnecessary dependency.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #603

7 years agoUse kernel slab for vn_cache and vn_file_cache
Chunwei Chen [Tue, 31 Jan 2017 21:44:01 +0000 (13:44 -0800)]
Use kernel slab for vn_cache and vn_file_cache

Resolve a false positive in the kmemleak checker by shifting to the
kernel slab.  It shows up because vn_file_cache is using KMC_KMEM
which is directly allocated using __get_free_pages, which is not
automatically tracked by kmemleak.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #599

7 years agoAdd a PAGESHIFT definition
David Quigley [Tue, 31 Jan 2017 18:36:18 +0000 (11:36 -0700)]
Add a PAGESHIFT definition

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: David Quigley <david.quigley@intel.com>
Closes #598

7 years agoTag 0.7.0-rc3
Brian Behlendorf [Fri, 20 Jan 2017 18:16:32 +0000 (10:16 -0800)]
Tag 0.7.0-rc3

Third release candidate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
7 years agoReimplement rt_mutex_owner to fix build with DEBUG & PREEMPT_RT_FULL
clefru [Thu, 19 Jan 2017 22:41:38 +0000 (23:41 +0100)]
Reimplement rt_mutex_owner to fix build with DEBUG & PREEMPT_RT_FULL

rt_mutex_owner is internal to kernel/locking/rtmutex_common.h and
inaccessible for SPL via the public kernel headers. The way of
accessing the owner has been stable since at least 3.13 ([1], [2]),
which is masking the lowest bit in the owner pointer in rt_mutex. We
do the same.

[1] http://lxr.free-electrons.com/source/kernel/locking/rtmutex_common.h?v=3.13#L99
[2] http://lxr.free-electrons.com/source/kernel/locking/rtmutex_common.h?v=4.9#L78

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Clemens Fruhwirth <clemens@endorphin.org>
Closes #593

7 years agoRemove identical if statements in module/spl/spl-vnode.c
George Melikov [Thu, 19 Jan 2017 22:32:45 +0000 (01:32 +0300)]
Remove identical if statements in module/spl/spl-vnode.c

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #594

7 years agoAdd support for recent kmem_cache_create_usercopy
Kevin Tanguy [Tue, 17 Jan 2017 20:05:14 +0000 (21:05 +0100)]
Add support for recent kmem_cache_create_usercopy

SLAB_USERCOPY flag was used to indicate PAX
not to kill copies from kernel to userland.

With recent grsecurity patchset and
CONFIG_GRKERNSEC_HIDESYM that enables
CONFIG_PAX_USERCOPY zfs would panic.

Handle newer API while keeping old one functional.

Tested-by: RageLtMan <rageltman@sempervictus>
Reviewed-by: spendergrsec <spender@grsecurity.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Kevin Tanguy <kevin.tanguy@ovh.net>
Closes #595

7 years agoUpdate struct member intializers to C89
RageLtMan [Fri, 13 Jan 2017 22:12:42 +0000 (17:12 -0500)]
Update struct member intializers to C89

When building SPL within the kernel tree, C99 initializers cause
build failures and need to be converted to C89 as kernel CFLAGS
specify -std=gnu89.

This fix was provided by @behlendorf in #595 discussion notes and
manually implemented in the current master revision.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: RageLtMan <rageltman@sempervictus>
Closes #597

7 years agoAdd support for rw semaphore under PREEMPT_RT_FULL
Clemens Fruhwirth [Sat, 17 Dec 2016 16:09:57 +0000 (17:09 +0100)]
Add support for rw semaphore under PREEMPT_RT_FULL

The main complication from the RT patch set is that the RW semaphore
locks change such that read locks on an rwsem can be taken only by
a single thread.  All other threads are locked out. This single
thread can take a read lock multiple times though. The underlying
implementation changes to a mutex with an additional read_depth
count.

The implementation can be best understood by inspecting the RT
patch.  rwsem_rt.h and rt.c give the best insight into how RT
rwsem works. My implementation for rwsem_tryupgrade is basically
an inversion of rt_downgrade_write found in rt.c. Please see the
comments in the code.

Unfortunately, I have to drop SPLAT rwlock test4 completely as this
test tries to take multiple locks from different threads, which RT
rwsems do not support.  Otherwise SPLAT, zconfig.sh, zpios-sanity.sh
and zfs-tests.sh pass on my Debian-testing VM with the kernel
linux-image-4.8.0-1-rt-amd64.

Tested-by: kernelOfTruth <kerneloftruth@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Clemens Fruhwirth <clemens@endorphin.org>
Closes zfsonlinux/zfs#5491
Closes #589
Closes #308

7 years agoRemove stale comment from rw_tryupgrade()
Clemens Fruhwirth [Sat, 17 Dec 2016 16:10:25 +0000 (17:10 +0100)]
Remove stale comment from rw_tryupgrade()

Commit f58040c0fc8bc6490fcc75db7fc3e709dfc3c656 should have removed
this comment which is no longer relevant.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Clemens Fruhwirth <clemens@endorphin.org>
Issue #589

7 years agoRefactor some splat macro to function
Chunwei Chen [Thu, 15 Dec 2016 02:24:47 +0000 (18:24 -0800)]
Refactor some splat macro to function

Refactor the code by making splat_test_{init,fini}, splat_subsystem_{init,fini}
into functions. They don't have reason to be macro and it would be too bloated
to inline every call.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
7 years agoFix splat memleak
Chunwei Chen [Thu, 15 Dec 2016 19:12:50 +0000 (11:12 -0800)]
Fix splat memleak

SPLAT_TEST_FINI didn't call kfree causing memleak.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
7 years agoAdd system_delay_taskq for long delay
Chunwei Chen [Thu, 8 Dec 2016 21:00:20 +0000 (13:00 -0800)]
Add system_delay_taskq for long delay

Add a dedicated system_delay_taskq for long delay like spa_deadman and
zpl_posix_acl_free. This will allow us to use system_taskq in the manner of
dispatch multiple tasks and call taskq_wait_outstanding.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #588

7 years agoLimit number of tasks shown in taskq proc
Chunwei Chen [Thu, 1 Dec 2016 18:06:27 +0000 (10:06 -0800)]
Limit number of tasks shown in taskq proc

To prevent holding tq_lock for too long.

Before zfsonlinux/zfs@8e71ab9, hogging delay tasks and cat /proc/spl/taskq
would easily cause a lockup. While that bug has been fixed. It's probably
still a good idea to do this just in case task lists grow too large.

Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #586

7 years agoAdd TASKQID_INVALID and TASKQID_INITIAL macros
Ubuntu [Fri, 28 Oct 2016 21:23:30 +0000 (21:23 +0000)]
Add TASKQID_INVALID and TASKQID_INITIAL macros

Add the TASKQID_INVALID and TASKQID_INITIAL macros and update the
taskq implementation and test cases to use them.  This is solely
for the purposes of readability and introduces no functional change.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
7 years agoFix vmem_size()
Ubuntu [Fri, 28 Oct 2016 20:56:38 +0000 (20:56 +0000)]
Fix vmem_size()

Add a minimal implementation of vmem_size() which accounts for the
virtual memory usage of the SPL's kmem cache.  This functionality
is only useful on 32-bit systems with a small virtual address space.

The following assumptions are made:

  1) The major SPL consumer of virtual memory is the kmem cache.
  2) Memory allocated with vmem_alloc() is short lived and can be ignored.
  3) Allow a 4MB floor as a generous pad given normal consumption.
  4) The spl_kmem_cache_sem only contends with cache create/destroy.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
7 years agoTag 0.7.0-rc2
Brian Behlendorf [Tue, 25 Oct 2016 20:13:49 +0000 (13:13 -0700)]
Tag 0.7.0-rc2

Second release candidate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
7 years agoLinux 4.9 compat: group_info changes
Chunwei Chen [Wed, 19 Oct 2016 00:30:41 +0000 (17:30 -0700)]
Linux 4.9 compat: group_info changes

In Linux 4.9, torvalds/linux@81243ea, group_info changed from 2d array via
->blocks to 1d array via ->gid. We change the spl cred functions accordingly.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #581

7 years agoFix splat-cred.c cred usage
Chunwei Chen [Wed, 19 Oct 2016 00:29:26 +0000 (17:29 -0700)]
Fix splat-cred.c cred usage

No need to crhold current_cred(), fix possible leak in splat_cred_test2

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #556

7 years agoFix crgetgroups out-of-bound and misc cred fix
Chunwei Chen [Tue, 18 Oct 2016 22:52:30 +0000 (15:52 -0700)]
Fix crgetgroups out-of-bound and misc cred fix

init_groups has 0 nblocks, therefore calling the current crgetgroups with
init_groups would result in out-of-bound access. We fix this by returning NULL
when nblocks is 0.

Cap crgetngroups to NGROUPS_PER_BLOCK, since crgetgroups will only return
blocks[0].

Also, remove all get_group_info. The cred already holds reference on the
group_info, and cred is not mutable. So there's no reason to hold extra
reference, if we hold cred.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #556

7 years agoFix out-of-bound in per_cpu in spl_random_init
tuxoko [Sat, 8 Oct 2016 03:59:46 +0000 (20:59 -0700)]
Fix out-of-bound in per_cpu in spl_random_init

When iterating per_cpu values, we need to use for_each_possible_cpu. While
NR_CPUS indicates the number of CPU supported by the kernel, it might not
initialize all of them if the kernel decides it's not possible to use them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #578

7 years agoLinux 4.8 compat: Fix RW_READ_HELD
tuxoko [Sat, 8 Oct 2016 03:53:58 +0000 (20:53 -0700)]
Linux 4.8 compat: Fix RW_READ_HELD

Linux 4.8, starting from torvalds/linux@19c5d690e, will set owner to 1 when
read held instead of leave it NULL. So we change the condition to
`rw_owner(rwp) <= 1` in RW_READ_HELD.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes zfsonlinux/zfs#5233
Closes #577

7 years agoFix p0 initializer
Brian Behlendorf [Wed, 5 Oct 2016 00:26:36 +0000 (17:26 -0700)]
Fix p0 initializer

Due to changes in the task_struct the following warning is occurs
when initializing the global p0.  Since this structure only exists
for it's address to be taken initialize it in a manor which isn't
sensitive to internal changes to the structure.

  module/spl/spl-generic.c:58:1: error: missing braces around
  initializer [-Werror=missing-braces]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #576

7 years agoFix aarch64 type warning
Brian Behlendorf [Sun, 2 Oct 2016 01:33:01 +0000 (18:33 -0700)]
Fix aarch64 type warning

Explicitly cast type in splat-rwlock.c test case to silence
the following warning.

  warning: format ‘%ld’ expects argument of type ‘long int’,
  but argument N has type ‘int’

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #574