]> git.proxmox.com Git - mirror_zfs.git/log
mirror_zfs.git
2 years agoReplace config/config.awk with simple sed invocation
наб [Sun, 10 Apr 2022 17:00:47 +0000 (19:00 +0200)]
Replace config/config.awk with simple sed invocation

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down test data
наб [Sun, 10 Apr 2022 16:24:48 +0000 (18:24 +0200)]
autoconf: use include directives instead of recursing down test data

We drop /multiple/ seconds off the generation, a dozen off a clean
rebuild, 185 files, and trivialise the distribution,
which can now be trivially generated via the provided snippets

Dist diff:
  -zfs-2.1.99/tests/zfs-tests/tests/functional/pam/utilities.kshlib
  +zfs-2.1.99/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down tests (mostly)
наб [Sun, 10 Apr 2022 00:46:19 +0000 (02:46 +0200)]
autoconf: use include directives instead of recursing down tests (mostly)

Only down to tests/zfs-tests/tests, but pull out C programs into the
main Makefile ‒ this means we get correct dependency tracking for all
programs (and parallelise across them)

dist diff:
  -zfs-2.1.99/tests/zfs-tests/tests/stress/
  -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.am
  -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.in

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down etc
наб [Sat, 9 Apr 2022 23:19:15 +0000 (01:19 +0200)]
autoconf: use include directives instead of recursing down etc

dist diff:
  -zfs-2.1.99/etc/systemd/system/50-zfs.preset.in
  +zfs-2.1.99/etc/systemd/system/50-zfs.preset

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down contrib
наб [Sat, 9 Apr 2022 22:16:59 +0000 (00:16 +0200)]
autoconf: use include directives instead of recursing down contrib

Also make the pyzfs build actually out-of-tree and quiet by default

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Rapptz <rapptz@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down udev
наб [Sat, 9 Apr 2022 18:05:18 +0000 (20:05 +0200)]
autoconf: use include directives instead of recursing down udev

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down rpm
наб [Sat, 9 Apr 2022 17:44:40 +0000 (19:44 +0200)]
autoconf: use include directives instead of recursing down rpm

Also simplify .gitignore

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoMove test-runner.1 into top-level man/
наб [Sat, 9 Apr 2022 17:20:52 +0000 (19:20 +0200)]
Move test-runner.1 into top-level man/

dist delta:
  +zfs-2.1.99/man/man1/test-runner.1
  -zfs-2.1.99/tests/test-runner/man/
  -zfs-2.1.99/tests/test-runner/man/test-runner.1

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down man
наб [Sat, 9 Apr 2022 17:19:09 +0000 (19:19 +0200)]
autoconf: use include directives instead of recursing down man

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down scripts
наб [Sat, 9 Apr 2022 16:35:53 +0000 (18:35 +0200)]
autoconf: use include directives instead of recursing down scripts

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: single-step includes
наб [Sat, 9 Apr 2022 12:37:22 +0000 (14:37 +0200)]
autoconf: single-step includes

Still descend, but only once: we get a lot of mileage out of nodist_

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down cmd
наб [Sat, 9 Apr 2022 02:09:55 +0000 (04:09 +0200)]
autoconf: use include directives instead of recursing down cmd

No installation diff, dist lost
  -zfs-2.1.99/cmd/fsck_zfs/fsck.zfs
which was distributed erroneously, since it's generated

Also clean gitrev on clean

Also add -e 'any possible bashisms' to default checkbashisms flags,
and fully parallelise it and shellcheck, and it works out-of-tree, too

Also align the Release in the dist META file correctly

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agocmd: zvol_id: don't build with -fno-stack-protector anymore
наб [Fri, 8 Apr 2022 01:58:14 +0000 (03:58 +0200)]
cmd: zvol_id: don't build with -fno-stack-protector anymore

 #569 was opened in 2012 and closed in 2015;
if the issue was still there we'd presumably've seen it?

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautoconf: use include directives instead of recursing down lib
наб [Thu, 7 Apr 2022 23:07:08 +0000 (01:07 +0200)]
autoconf: use include directives instead of recursing down lib

As a bonus, this also adds zfs-mount-generator (previously undescended
down) and libzstd (not included) to CppCheck

As a bonus bonus, abigail rules work out-of-tree, too

Against current trunk:
  $ diff -U0 ./destdir.listing ~/store/code/zfs/destdir.listing
  -destdir/usr/local/include/libspl/sscanf.h

  $ diff --color -U0 ./zfs-2.1.99.tar.gz.listing ../oot/zfs-2.1.99.tar.gz.listing | grep -v @@ | grep -v /Makefile
  -zfs-2.1.99/config/Abigail.am
  -zfs-2.1.99/lib/libspl/include/util/
  -zfs-2.1.99/lib/libspl/include/util/sscanf.h

  $ diff --color -U0 ./zfs-2.1.99.tar.gz.listing ../oot/zfs-2.1.99.tar.gz.listing | grep -v @@ | grep /Makefile
  -zfs-2.1.99/lib/libavl/Makefile.in
  -zfs-2.1.99/lib/libefi/Makefile.in
  -zfs-2.1.99/lib/libicp/Makefile.in
  -zfs-2.1.99/lib/libnvpair/Makefile.in
  -zfs-2.1.99/lib/libshare/Makefile.in
  -zfs-2.1.99/lib/libspl/include/Makefile.in
  -zfs-2.1.99/lib/libspl/include/os/freebsd/Makefile.am
  -zfs-2.1.99/lib/libspl/include/os/freebsd/Makefile.in
  -zfs-2.1.99/lib/libspl/include/os/freebsd/sys/Makefile.am
  -zfs-2.1.99/lib/libspl/include/os/freebsd/sys/Makefile.in
  -zfs-2.1.99/lib/libspl/include/os/linux/Makefile.am
  -zfs-2.1.99/lib/libspl/include/os/linux/Makefile.in
  -zfs-2.1.99/lib/libspl/include/os/linux/sys/Makefile.am
  -zfs-2.1.99/lib/libspl/include/os/linux/sys/Makefile.in
  -zfs-2.1.99/lib/libspl/include/os/Makefile.am
  -zfs-2.1.99/lib/libspl/include/os/Makefile.in
  -zfs-2.1.99/lib/libspl/include/rpc/Makefile.am
  -zfs-2.1.99/lib/libspl/include/rpc/Makefile.in
  -zfs-2.1.99/lib/libspl/include/sys/dktp/Makefile.am
  -zfs-2.1.99/lib/libspl/include/sys/dktp/Makefile.in
  -zfs-2.1.99/lib/libspl/include/sys/Makefile.am
  -zfs-2.1.99/lib/libspl/include/sys/Makefile.in
  -zfs-2.1.99/lib/libspl/include/util/Makefile.am
  -zfs-2.1.99/lib/libspl/include/util/Makefile.in
  -zfs-2.1.99/lib/libspl/Makefile.in
  -zfs-2.1.99/lib/libtpool/Makefile.in
  -zfs-2.1.99/lib/libunicode/Makefile.in
  -zfs-2.1.99/lib/libuutil/Makefile.in
  -zfs-2.1.99/lib/libzfsbootenv/Makefile.in
  -zfs-2.1.99/lib/libzfs_core/Makefile.in
  -zfs-2.1.99/lib/libzfs/Makefile.in
  -zfs-2.1.99/lib/libzpool/Makefile.in
  -zfs-2.1.99/lib/libzstd/Makefile.in
  -zfs-2.1.99/lib/libzutil/Makefile.in
  -zfs-2.1.99/lib/Makefile.in

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agolibzfs: pool: fix false-positives -Wmaybe-uninitialised
наб [Thu, 7 Apr 2022 20:49:22 +0000 (22:49 +0200)]
libzfs: pool: fix false-positives -Wmaybe-uninitialised

As noted by gcc (Debian 10.2.1-6) 10.2.1 20210110

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agomodule: Makefile: cppcheck: zfs_config.h lives in builddir
наб [Thu, 7 Apr 2022 00:22:37 +0000 (02:22 +0200)]
module: Makefile: cppcheck: zfs_config.h lives in builddir

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoconfig: user: drop ZONENAME, avoid lying about being Linux-only
наб [Wed, 6 Apr 2022 22:41:46 +0000 (00:41 +0200)]
config: user: drop ZONENAME, avoid lying about being Linux-only

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agolibspl: include: remove [util/]sscanf.h
наб [Wed, 6 Apr 2022 01:12:33 +0000 (03:12 +0200)]
libspl: include: remove [util/]sscanf.h

Unused, empty, installs in a weird location

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agocopy-builtin: add hooks with sed/>>
наб [Tue, 5 Apr 2022 23:34:25 +0000 (01:34 +0200)]
copy-builtin: add hooks with sed/>>

The order in fs/Makefile doesn't matter,
the order in fs/Kconfig is preserved (ext2 is included as the first
thing in the first if BUILD block, and only once), but I don't think it
matters much either, realistically

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoautogen.sh: explicitly build its containing directory
наб [Tue, 5 Apr 2022 22:36:09 +0000 (00:36 +0200)]
autogen.sh: explicitly build its containing directory

No changes in currently-accepted usages (no-argument), but allows
  /src/path/autogen.sh && /src/path/configure
for simpler out-of-tree builds

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoRemove compat spl-x.y.z from the distribution
наб [Tue, 5 Apr 2022 22:20:16 +0000 (00:20 +0200)]
Remove compat spl-x.y.z from the distribution

This was added in 93ce2b4ca5a40c41ac945cd3aaf4a4a22bb751e1 ("Update
build system and packaging"), which merged the SPL and ZFS trees,
and included in 0.8.0; "the next major release" was 2.0.0

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoMakefile: zfs-tests lives in srcdir; zfs-tests: accept common.sh path
наб [Tue, 5 Apr 2022 22:15:45 +0000 (00:15 +0200)]
Makefile: zfs-tests lives in srcdir; zfs-tests: accept common.sh path

This fixes out-of-tree builds

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

2 years agoWorkaround broken VDEV_UPATH
Rich Ercolani [Tue, 10 May 2022 17:14:07 +0000 (13:14 -0400)]
Workaround broken VDEV_UPATH

Sometimes, for reasons I haven't looked into yet, VDEV_UPATH
gets set to /dev/(null), breaking all these scripts.

It'd be nice to have a fallback case to avoid total failure.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13436

2 years agoAdd workaround for broken Linux pipes
Rich Ercolani [Mon, 9 May 2022 23:33:55 +0000 (19:33 -0400)]
Add workaround for broken Linux pipes

Linux has an unresolved hang if you resize a pipe with bytes
in it.

Since there's no obvious way to detect this happening, added a
workaround to disable resizing the pipe buffer if you set an
environment variable.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13309

2 years agoabd_os: remove redundant refcount creation for abd_children
hping [Mon, 9 May 2022 23:30:16 +0000 (07:30 +0800)]
abd_os: remove redundant refcount creation for abd_children

Refcount creation for abd_zero_scatter->abd_children is redundant in
abd_alloc_zero_scatter, as it has been done in abd_init_struct.

In addition, abd_children is undefined when ZFS_DEBUG is disabled, the
reference of abd_children in abd_alloc_zero_scatter breaks build of
libzpool when ZFS_DEBUG is disabled.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Ping Huang <huangping@smartx.com>
Closes #13429

2 years agoman: zpool-import.8: -d -or -c
наб [Mon, 9 May 2022 23:03:17 +0000 (01:03 +0200)]
man: zpool-import.8: -d -or -c

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13437

2 years agoFix functions without a prototype
Aidan Harris [Fri, 6 May 2022 18:57:37 +0000 (18:57 +0000)]
Fix functions without a prototype

clang-15 emits the following error message for functions without
a prototype:

fs/zfs/os/linux/spl/spl-kmem-cache.c:1423:27: error:
  a function declaration without a prototype is deprecated
  in all versions of C [-Werror,-Wstrict-prototypes]

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Aidan Harris <me@aidanharr.is>
Closes #13421

2 years agozpool: guard vs_noalloc and vs_pspace with VDEV_STAT_VALID()
наб [Thu, 5 May 2022 16:45:12 +0000 (18:45 +0200)]
zpool: guard vs_noalloc and vs_pspace with VDEV_STAT_VALID()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13412

2 years agoCorrected edge case in uncompressed ARC->L2ARC handling
Rich Ercolani [Wed, 4 May 2022 18:59:30 +0000 (14:59 -0400)]
Corrected edge case in uncompressed ARC->L2ARC handling

I genuinely don't know why this didn't come up before,
but adding the LZ4 early abort pointed out this flaw,
in which we're allocating a buffer of one size, and
then telling the compressor that we're handing it buffers
of a different size, which may be Very Different - say,
allocating 512b and then telling it the inputs are 128k.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Amanakis <gamanakis@gmail.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13375

2 years agoFreeBSD: use zero_region instead of allocating a dedicated page
Mateusz Guzik [Wed, 4 May 2022 18:46:37 +0000 (20:46 +0200)]
FreeBSD: use zero_region instead of allocating a dedicated page

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Closes #13406

2 years agoFix incorrect use of unit prefix names in man pages
WHR [Tue, 3 May 2022 12:07:04 +0000 (20:07 +0800)]
Fix incorrect use of unit prefix names in man pages

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes #13363

2 years agoImprove mg_aliquot math
Alexander Motin [Wed, 4 May 2022 18:33:42 +0000 (14:33 -0400)]
Improve mg_aliquot math

When calculating mg_aliquot alike to #12046 use number of unique data
disks in the vdev, not the total number of children vdev.  Increase
default value of the tunable from 512KB to 1MB to compensate.

Before this change each disk in striped pool was getting 512KB of
sequential data, in 2-wide mirror -- 1MB, in 3-wide RAIDZ1 -- 768KB.
After this change in all the cases each disk should get 1MB.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13388

2 years agoReduce dbuf_find() lock contention
Brian Behlendorf [Wed, 4 May 2022 18:17:29 +0000 (11:17 -0700)]
Reduce dbuf_find() lock contention

Holding a dbuf is a common operation which can become highly contended
in dbuf_find() when acquiring the dbuf hash mutex.  This is particularly
true on Linux when reading/writing volumes since by default up to 32
threads from the zvol_taskq may be taking a hold of the same dbuf.
This should also be observable on FreeBSD as long as there are enough
processes accessing the volume concurrently.

This is further aggregrated by the fact that only the block id will
be unique when calculating the dbuf hash for a single volume.  The
objset id, object id, and level will be the same for data blocks.
This has been observed to result in a somehwat less than uniform hash
distribution and a longer than expected max hash chain depth (~20)
on a large memory system (256 GB) using volumes.

This commit improves the siutation by switching the hash mutex to
an rwlock to allow concurrent lookups, and increasing DBUF_RWLOCKS
from 2048 to 8192 to further reduce the odds of a hash collision.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13405

2 years agoSpeed up WB_SYNC_NONE when a WB_SYNC_ALL occurs simultaneously
Shaan Nobee [Tue, 3 May 2022 20:23:26 +0000 (00:23 +0400)]
Speed up WB_SYNC_NONE when a WB_SYNC_ALL occurs simultaneously

Page writebacks with WB_SYNC_NONE can take several seconds to complete
since they wait for the transaction group to close before being
committed. This is usually not a problem since the caller does not
need to wait. However, if we're simultaneously doing a writeback
with WB_SYNC_ALL (e.g via msync), the latter can block for several
seconds (up to zfs_txg_timeout) due to the active WB_SYNC_NONE
writeback since it needs to wait for the transaction to complete
and the PG_writeback bit to be cleared.

This commit deals with 2 cases:

- No page writeback is active. A WB_SYNC_ALL page writeback starts
  and even completes. But when it's about to check if the PG_writeback
  bit has been cleared, another writeback with WB_SYNC_NONE starts.
  The sync page writeback ends up waiting for the non-sync page
  writeback to complete.

- A page writeback with WB_SYNC_NONE is already active when a
  WB_SYNC_ALL writeback starts. The WB_SYNC_ALL writeback ends up
  waiting for the WB_SYNC_NONE writeback.

The fix works by carefully keeping track of active sync/non-sync
writebacks and committing when beneficial.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Shaan Nobee <sniper111@gmail.com>
Closes #12662
Closes #12790

2 years agoFreeBSD: Clean up the use of ioflags
Pawel Jakub Dawidek [Mon, 2 May 2022 23:26:28 +0000 (16:26 -0700)]
FreeBSD: Clean up the use of ioflags

- Prefer O_* flags over F* flags that mostly mirror O_* flags anyway,
  but O_* flags seem to be preferred.
- Simplify the code as all the F*SYNC flags were defined as FFSYNC flag.
- Don't define FRSYNC flag, so we don't generate unnecessary ZIL commits.
- Remove EXCL define, FreeBSD ignores the excl argument for zfs_create()
  anyway.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #13400

2 years agoAdd missing replay entry in zvol_replay_vector for TX_SETSAXATTR
Jitendra Patidar [Mon, 2 May 2022 18:01:26 +0000 (23:31 +0530)]
Add missing replay entry in zvol_replay_vector for TX_SETSAXATTR

Commit 361a7e8 (log xattr=sa create/remove/update to ZIL) introduced a
TX_SETSAXATTR, but missed to add a corresponding entry in
zvol_replay_vector. Adding a missing replay entry in zvol_replay_vector.

Reviewed-by: Christian Schwarz <christian.schwarz@nutanix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jitendra Patidar <jitendra.patidar@nutanix.com>
Closes #13396
Closes #13395

2 years agoSilence unused-but-set-variable warnings
Brian Behlendorf [Fri, 29 Apr 2022 21:21:11 +0000 (14:21 -0700)]
Silence unused-but-set-variable warnings

Clang 13.0.0 added support for `Wunused-but-set-parameter` and
`-Wunused-but-set-variable` which correctly detects two unused
variables in zstd resulting in a build failure.  This commit
annotates these instances accordingly.

  https://releases.llvm.org/13.0.1/tools/clang/docs/ReleaseNotes.html#id6

In FSE_createCTable(), malloc() is intentionally defined as NULL when
compiled in the kernel so the variable is unused.

  zstd/lib/compress/fse_compress.c:307:12: error: variable 'size'
  set but not used [-Werror,-Wunused-but-set-variable]

Additionally, in ZSTD_seqDecompressedSize() the assert is compiled
out similarly resulting in an unused variable.

  zstd/lib/compress/zstd_compress_superblock.c:412:12: error: variable
  'litLengthSum' set but not used [-Werror,-Wunused-but-set-variable]

Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13382

2 years agoDefault zfs_max_recordsize to 16M
Rich Ercolani [Thu, 28 Apr 2022 22:12:24 +0000 (18:12 -0400)]
Default zfs_max_recordsize to 16M

Increase the default allowed maximum recordsize from 1M to 16M.
As described in the zfs(4) man page, there are significant costs
which need to be considered before using very large blocks.
However, there are scenarios where they make good sense and
it should no longer be necessary to artificially restrict their
use behind a module option.

Note that for 32-bit platforms we continue to leave this
restriction in place due to the limited virtual address space
available (256-512MB).  On these systems only a handful
of blocks could be cached at any one time severely impacting
performance and potentially stability.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12830
Closes #13302

2 years agoFix O_APPEND for Linux 3.15 and older kernels
Brian Behlendorf [Wed, 27 Apr 2022 19:56:17 +0000 (12:56 -0700)]
Fix O_APPEND for Linux 3.15 and older kernels

When using a Linux kernel which predates the iov_iter interface the
O_APPEND flag should be applied in zpl_aio_write() via the call to
generic_write_checks().  The updated pos variable  was incorrectly
ignored resulting in the current offset being used.

This issue should only realistically impact the RHEL/CentOS 7.x
kernels which are based on Linux 3.10.

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

2 years agoLinux 5.18 compat: replace __set_page_dirty_nobuffers
Satadru Pramanik [Wed, 27 Apr 2022 19:54:17 +0000 (15:54 -0400)]
Linux 5.18 compat: replace __set_page_dirty_nobuffers

Replace __set_page_dirty_nobuffers with filemap_dirty_folio.

Upstream-commit: 6b1f86f8e9c7f9de7ca1cb987b2cf25e99b1ae3a
("Merge tag 'folio-5.18b' of
git://git.infradead.org/users/willy/pagecache ")

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Authored-by: Satadru Pramanik <satadru@gmail.com>
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Closes #13325
Closes #13380

2 years agozfs: holds: dequadratify
наб [Sat, 23 Apr 2022 17:21:09 +0000 (19:21 +0200)]
zfs: holds: dequadratify

Before:
  15  0m0.177s
  30  0m0.653s
  45  0m1.289s
  60  0m2.129s
  75  0m3.264s
  90  0m4.397s
  100 0m5.996s
  117 0m8.552s

After:
  30  0m0.053s
  117 0m0.125s

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13372
Closes #13373

2 years agozfs: holds: general cleanup
наб [Sat, 23 Apr 2022 17:19:41 +0000 (19:19 +0200)]
zfs: holds: general cleanup

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13373

2 years agoPPC get_user workaround
Damian Szuberski [Tue, 26 Apr 2022 17:52:40 +0000 (03:52 +1000)]
PPC get_user workaround

Linux 5.12 PPC 5.12 get_user() and __copy_from_user_inatomic()
inline helpers very indirectly include a reference to the GPL'd
array mmu_feature_keys[] and fails to build. Workaround this by
using copy_from_user() and throwing EFAULT for any calls to
__copy_from_user_inatomic(). This is a workaround until a fix
for Linux commit 7613f5a66becfd0e43a0f34de8518695888f5458
"powerpc/64s/kuap: Use mmu_has_feature()" is fully addressed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Authored-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #11958
Closes #12590
Closes #13367

2 years agoautoconf: Pretend `CONFIG_MODULES` is always on
Damian Szuberski [Tue, 26 Apr 2022 17:47:09 +0000 (03:47 +1000)]
autoconf: Pretend `CONFIG_MODULES` is always on

- Unconditionally inject `CONFIG_MODULES` make variable
  and `#define CONFIG_MODULES` to Kbuild in `ZFS_LINUX_COMPILE`
  autoconf function to emulate loadable kernel modules support.
  This allows OpenZFS to perform Linux checks despite
  `CONFIG_MODULES=n` in the actual Linux config.

- Add `ZFS_AC_KERNEL_CONFIG_MODULES` check which encompasses
  the logic from `ZFS_AC_KERNEL_TEST_MODULE` with additional
  diagnostic messages to the user

- Removed `ZFS_AC_KERNEL_TEST_MODULE` as it merely duplicates
  every check in `ZFS_AC_KERNEL_CONFIG_DEFINED`

- Moved `ZFS_AC_MODULE_SYMVERS` after `ZFS_AC_KERNEL_CONFIG_DEFINED`
  so the user has a chance to see the proper diagnostic from the
  steps before.

A workaround for Linux's

```
commit 3e3005df73b535cb849cf4ec8075d6aa3c460f68
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Wed Mar 31 22:38:03 2021 +0900

kbuild: unify modules(_install) for in-tree and external modules

If you attempt to build or install modules ('make modules(_install)'
with CONFIG_MODULES disabled, you will get a clear error message, but
nothing for external module builds.

Factor out the modules and modules_install rules into the common part,
so you will get the same error message when you try to build external
modules with CONFIG_MODULES=n.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
```

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #10832
Closes #13361

2 years agoImprove log spacemap load time
Alexander Motin [Tue, 26 Apr 2022 17:44:21 +0000 (13:44 -0400)]
Improve log spacemap load time

Previous flushing algorithm limited only total number of log blocks to
the minimum of 256K and 4x number of metaslabs in the pool.  As result,
system with 1500 disks with 1000 metaslabs each, touching several new
metaslabs each TXG could grow spacemap log to huge size without much
benefits.  We've observed one of such systems importing pool for about
45 minutes.

This patch improves the situation from five sides:
 - By limiting maximum period for each metaslab to be flushed to 1000
TXGs, that effectively limits maximum number of per-TXG spacemap logs
to load to the same number.
 - By making flushing more smooth via accounting number of metaslabs
that were touched after the last flush and actually need another flush,
not just ms_unflushed_txg bump.
 - By applying zfs_unflushed_log_block_pct to the number of metaslabs
that were touched after the last flush, not all metaslabs in the pool.
 - By aggressively prefetching per-TXG spacemap logs up to 16 TXGs in
advance, making log spacemap load process for wide HDD pool CPU-bound,
accelerating it by many times.
 - By reducing zfs_unflushed_log_block_max from 256K to 128K, reducing
single-threaded by nature log processing time from ~10 to ~5 minutes.

As further optimization we could skip bumping ms_unflushed_txg for
metaslabs not touched since the last flush, but that would be an
incompatible change, requiring new pool feature.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12789

2 years agoImprove zpool status output, list all affected datasets
George Amanakis [Tue, 26 Apr 2022 00:25:42 +0000 (02:25 +0200)]
Improve zpool status output, list all affected datasets

Currently, determining which datasets are affected by corruption is
a manual process.

The primary difficulty in reporting the list of affected snapshots is
that since the error was initially found, the snapshot where the error
originally occurred in, may have been deleted. To solve this issue, we
add the ID of the head dataset of the original snapshot which the error
was detected in, to the stored error report. Then any time a filesystem
is deleted, the errors associated with it are deleted as well. Any time
a clone promote occurs, we modify reports associated with the original
head to refer to the new head. The stored error reports are identified
by this head ID, the birth time of the block which the error occurred
in, as well as some information about the error itself are also stored.

Once this information is stored, we can find the set of datasets
affected by an error by walking back the list of snapshots in the given
head until we find one with the appropriate birth txg, and then traverse
through the snapshots of the clone family, terminating a branch if the
block was replaced in a given snapshot. Then we report this information
back to libzfs, and to the zpool status command, where it is displayed
as follows:

 pool: test
 state: ONLINE
status: One or more devices has experienced an error resulting in data
        corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
        entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:00:00 with 800 errors on Fri Dec  3
08:27:57 2021
config:

        NAME        STATE     READ WRITE CKSUM
        test        ONLINE       0     0     0
          sdb       ONLINE       0     0 1.58K

errors: Permanent errors have been detected in the following files:

        test@1:/test.0.0
        /test/test.0.0
        /test/1clone/test.0.0

A new feature flag is introduced to mark the presence of this change, as
well as promotion and backwards compatibility logic. This is an updated
version of #9175. Rebase required fixing the tests, updating the ABI of
libzfs, updating the man pages, fixing bugs, fixing the error returns,
and updating the old on-disk error logs to the new format when
activating the feature.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Co-authored-by: TulsiJain <tulsi.jain@delphix.com>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #9175
Closes #12812

2 years agotests: cli_user: zfs_001_neg: print the problematic lines
наб [Fri, 22 Apr 2022 18:59:51 +0000 (20:59 +0200)]
tests: cli_user: zfs_001_neg: print the problematic lines

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13352

2 years agoman: zfs-send.8: fix -X synopses and description
наб [Thu, 24 Mar 2022 20:07:07 +0000 (21:07 +0100)]
man: zfs-send.8: fix -X synopses and description

Also clean up the horrendously verbose -X handling in zfs_main()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13352

2 years agozvol_wait: Ignore locked zvols
Richard Laager [Fri, 22 Apr 2022 22:37:03 +0000 (17:37 -0500)]
zvol_wait: Ignore locked zvols

"When an encrypted zvol is locked the zfs-volume-wait service does not
start.  The /sbin/zvol_wait should not wait for links when the volume
has property keystatus=unavailable."
-- https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1888405

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Thanks: James Dingwall <james-launchpad@dingwall.me.uk>
Signed-off-by: Richard Laager <rlaager@wiktel.com>
Closes #10662

2 years agoLinux 5.18 compat: kobj_type.default_attrs replaced with default_groups
наб [Thu, 21 Apr 2022 14:27:15 +0000 (16:27 +0200)]
Linux 5.18 compat: kobj_type.default_attrs replaced with default_groups

Upstream-commit: cdb4f26a63c391317e335e6e683a614358e70aeb ("kobject:
 kobj_type: remove default_attrs")
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13357

2 years agolinux: module: zfs: sysfs: constify types and attrs
наб [Thu, 21 Apr 2022 12:27:51 +0000 (14:27 +0200)]
linux: module: zfs: sysfs: constify types and attrs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13357

2 years agoscripts: zfs.sh: explicitly unload all modules via rmmod
наб [Thu, 21 Apr 2022 11:32:06 +0000 (13:32 +0200)]
scripts: zfs.sh: explicitly unload all modules via rmmod

modprobe -r only works for depmodded modules, but this also means we
have to re-iterate legacy modules, and in the right order

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13356

2 years agoscripts: zfs.sh: explicitly ignore unloaded modules when unloading
наб [Thu, 21 Apr 2022 11:29:12 +0000 (13:29 +0200)]
scripts: zfs.sh: explicitly ignore unloaded modules when unloading

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13356

2 years agoStrengthen Linux kernel capabilities detection
Damian Szuberski [Thu, 21 Apr 2022 16:37:11 +0000 (18:37 +0200)]
Strengthen Linux kernel capabilities detection

- Add `CONFIG_BLOCK` Linux config requirement to
  `ZFS_AC_KERNEL_CONFIG_DEFINED`. OpenZFS won't compile without
  that block device support due to large amount of functional
  dependencies on it.

- Remove dependency on `groups_alloc()` in
  `ZFS_AC_KERNEL_SRC_GROUP_INFO_GID` to circumvent the missing stub
  in Linux 4.X kernel headers.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #13351

2 years agocontrib: dracut: remove getargbool polyfill
наб [Tue, 5 Apr 2022 00:56:57 +0000 (02:56 +0200)]
contrib: dracut: remove getargbool polyfill

It was originally released in dracut 008 in February 2011;
we can probably drop it now

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agoAdd dracut.zfs.7
наб [Mon, 4 Apr 2022 23:14:49 +0000 (01:14 +0200)]
Add dracut.zfs.7

Thorough documentation with a dracut.bootup(7)-style flowchart,
dracut.cmdline(7)-style cmdline listing,
and per-file docs like the old README

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: zfs-needshutdown: don't list
наб [Mon, 4 Apr 2022 23:09:11 +0000 (01:09 +0200)]
contrib: dracut: zfs-needshutdown: don't list

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: zfs-{rollback,snapshot}-bootfs: order after key loading
наб [Mon, 4 Apr 2022 22:19:38 +0000 (00:19 +0200)]
contrib: dracut: zfs-{rollback,snapshot}-bootfs: order after key loading

This fixes at least one race I got with an encrypted root

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: don't require essentials to be under the same encroot
наб [Mon, 4 Apr 2022 21:39:18 +0000 (23:39 +0200)]
contrib: dracut: don't require essentials to be under the same encroot

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: inline single-use import_pool, move single-use ask_for_password
наб [Mon, 4 Apr 2022 21:24:29 +0000 (23:24 +0200)]
contrib: dracut: inline single-use import_pool, move single-use ask_for_password

Also don't set ROOTFS_MOUNTED; the final mention was removed in dracut
011 from July 2011

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: zfs-lib: remove find_bootfs
наб [Mon, 4 Apr 2022 21:16:59 +0000 (23:16 +0200)]
contrib: dracut: zfs-lib: remove find_bootfs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: zfs-lib: simplify ask_for_password
наб [Mon, 4 Apr 2022 20:57:35 +0000 (22:57 +0200)]
contrib: dracut: zfs-lib: simplify ask_for_password

The only user is mount-zfs.sh (non-systemd systems),
so reduce it to what it needs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib; dracut: flatten zfs-load-key, simplify zfs-env-bootfs
наб [Mon, 4 Apr 2022 20:52:43 +0000 (22:52 +0200)]
contrib; dracut: flatten zfs-load-key, simplify zfs-env-bootfs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib; dracut: centralise root= parsing, actually support root=s
наб [Mon, 4 Apr 2022 20:45:58 +0000 (22:45 +0200)]
contrib; dracut: centralise root= parsing, actually support root=s

So far, everything parsed root= manually, which meant that while
zfs-parse.sh was updated, and supposedly supported + -> ' ' conversion,
it meant nothing

Instead, centralise parsing, and allow:
  root=
  root=zfs
  root=zfs:
  root=zfs:AUTO

  root=ZFS=data/set
  root=zfs:data/set
  root=zfs:ZFS=data/set (as a side-effect; allowed but undocumented)

  rootfstype=zfs AND root=data/set <=> root=data/set
  rootfstype=zfs AND root=         <=> root=zfs:AUTO

So rootfstype=zfs /also/ behaves as expected, and + decoding works

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: parse-zfs: stop pretending we support FILESYSTEM=
наб [Mon, 4 Apr 2022 18:59:53 +0000 (20:59 +0200)]
contrib: dracut: parse-zfs: stop pretending we support FILESYSTEM=

It was added in the original ae26d0465a ("Add dracut support") commit
in 2011, and was then broken a bit later with the advent of
dracut-zfs-generator, or maybe earlier as part of other churn

Either way, it's broken, and has been in 2.0+ as well, and no-one
complained. Stop pretending we support it at all

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agocontrib: dracut: parse-zfs: drop initqueue-finished for i/f
наб [Mon, 4 Apr 2022 16:38:07 +0000 (18:38 +0200)]
contrib: dracut: parse-zfs: drop initqueue-finished for i/f

The switch was released in dracut 009 in March 2011,
we can safely get rid of the compatibility hook

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291

2 years agoCorrected oversight in ZERO_RANGE behavior
Rich Ercolani [Wed, 20 Apr 2022 23:07:03 +0000 (19:07 -0400)]
Corrected oversight in ZERO_RANGE behavior

It turns out, no, in fact, ZERO_RANGE and PUNCH_HOLE do
have differing semantics in some ways - in particular,
one requires KEEP_SIZE, and the other does not.

Also added a zero-range test to catch this, corrected a flaw
that made the punch-hole test succeed vacuously, and a typo
in file_write.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13329
Closes #13338

2 years agoFreeBSD: Fix translation from ABD to physical pages
Alexander Motin [Wed, 20 Apr 2022 23:05:38 +0000 (19:05 -0400)]
FreeBSD: Fix translation from ABD to physical pages

In hypothetical case of non-linear ABD with single segment, multiple
to page size but not aligned to it, vdev_geom_fill_unmap_cb() could
fill one page less into bio_ma array.

I am not sure it is exploitable, but better to be safe than sorry.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reported-by: Mark Johnston <markj@FreeBSD.org>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #13345

2 years agoman: ... -> … again
наб [Thu, 24 Mar 2022 19:14:25 +0000 (20:14 +0100)]
man: ... -> … again

zfs-program.8 is left, but that's literal Lua syntax

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13255

2 years agorpm -> deb doesn't fail when optional packages are missing
Damian Szuberski [Wed, 20 Apr 2022 20:43:42 +0000 (22:43 +0200)]
rpm -> deb doesn't fail when optional packages are missing

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #13331
Closes #13336

2 years agoDocument zfs inherit -S's interaction with noninheritable properties
наб [Sat, 16 Apr 2022 14:07:04 +0000 (16:07 +0200)]
Document zfs inherit -S's interaction with noninheritable properties

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11894
Closes #13335

2 years agozpool_history_unpack: return correct errno on nvlist_unpack failure
Low-power [Wed, 20 Apr 2022 20:35:44 +0000 (04:35 +0800)]
zpool_history_unpack: return correct errno on nvlist_unpack failure

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes #13321

2 years agolinux: module: uninstall legacy modules on (un)installation
наб [Mon, 4 Apr 2022 11:16:31 +0000 (13:16 +0200)]
linux: module: uninstall legacy modules on (un)installation

This can be reverted once we're sure nobody's using them anymore
(post-3.0 release?)

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274

2 years agoscripts: zfs.sh: unload zfs with dependencies
наб [Mon, 4 Apr 2022 11:08:59 +0000 (13:08 +0200)]
scripts: zfs.sh: unload zfs with dependencies

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274

2 years agoscripts: zfs.sh: make usage make sense
наб [Mon, 4 Apr 2022 10:55:41 +0000 (12:55 +0200)]
scripts: zfs.sh: make usage make sense

We don't pass the arguments as arguments

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274

2 years agoscripts: zfs.sh: remove cat
наб [Mon, 4 Apr 2022 10:48:47 +0000 (12:48 +0200)]
scripts: zfs.sh: remove cat

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274

2 years agolinux: module: weld all but spl.ko into zfs.ko
наб [Thu, 31 Mar 2022 15:20:50 +0000 (17:20 +0200)]
linux: module: weld all but spl.ko into zfs.ko

Originally it was thought it would be useful to split up the kmods
by functionality.  This would allow external consumers to only load
what was needed.  However, in practice we've never had a case where
this functionality would be needed, and conversely managing multiple
kmods can be awkward.  Therefore, this change merges all but the
spl.ko kmod in to a single zfs.ko kmod.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274

2 years agoImprove the inline descriptions of the ARC module parameters
Allan Jude [Wed, 20 Apr 2022 20:16:25 +0000 (16:16 -0400)]
Improve the inline descriptions of the ARC module parameters

These are displayed as the descriptions of the sysctl's on FreeBSD

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Closes #13334

2 years agoFix style checking error introduced by zfs-mount changes
Paul Dagnelie [Tue, 19 Apr 2022 20:55:04 +0000 (13:55 -0700)]
Fix style checking error introduced by zfs-mount changes

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #13347

2 years agoLinux 5.17 compat: GENHD_FL_EXT_DEVT / GENHD_FL_NO_PART_SCAN
Brian Behlendorf [Tue, 19 Apr 2022 17:38:04 +0000 (10:38 -0700)]
Linux 5.17 compat: GENHD_FL_EXT_DEVT / GENHD_FL_NO_PART_SCAN

As of the 5.17 kernel the GENHD_FL_EXT_DEVT flag has been removed
and the GENHD_FL_NO_PART_SCAN flag renamed GENHD_FL_NO_PART. Update
zvol_alloc() to set GENHD_FL_NO_PART for the newer kernels which
is sufficient.  The behavior for prior kernels remains unchanged.

1ebe2e5f ("block: remove GENHD_FL_EXT_DEVT")
46e7eac6 ("block: rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART")

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

2 years agoinit.d/zfs-mount: Don't fsck or mount/umount fstab entries
omni [Fri, 15 Apr 2022 21:26:44 +0000 (21:26 +0000)]
init.d/zfs-mount: Don't fsck or mount/umount fstab entries

This is better handled by existing OS toolset.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: omni <omni+vagant@hack.org>
Issue #7374
Closes #12780

2 years agoFix 'zpool history' sometimes fails without reporting any error
Low-power [Fri, 15 Apr 2022 21:16:07 +0000 (05:16 +0800)]
Fix 'zpool history' sometimes fails without reporting any error

The corresponding function 'zpool_get_history' in libzfs would printing
an error messages only when the ioctl call failed.

Add missing error reporting, specifically memory allocation failures
and error from 'zpool_history_unpack'.

Also avoid possibly reading of uninitialized 'err' variable in case
the requested offset pasts EOF.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: WHR <msl0000023508@gmail.com>
Issue #13322
Closes #13320

2 years agolibzfs: import: zpool_clear_label: bool for boolean status
наб [Thu, 7 Apr 2022 12:00:38 +0000 (14:00 +0200)]
libzfs: import: zpool_clear_label: bool for boolean status

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13304

2 years agolibzfs: import: zpool_clear_label: don't allocate another time for L2ARC header
наб [Thu, 7 Apr 2022 02:37:16 +0000 (04:37 +0200)]
libzfs: import: zpool_clear_label: don't allocate another time for L2ARC header

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13304

2 years agolibzfs: import: zpool_clear_label: actually fail if clearing l2arc header fails
наб [Thu, 7 Apr 2022 02:32:27 +0000 (04:32 +0200)]
libzfs: import: zpool_clear_label: actually fail if clearing l2arc header fails

Found with -Wunused-but-set-variable on Clang trunk

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13304

2 years agomodule: zfs: vdev_removal: remove unused num_indirect
наб [Thu, 7 Apr 2022 02:26:30 +0000 (04:26 +0200)]
module: zfs: vdev_removal: remove unused num_indirect

Found with -Wunused-but-set-variable on Clang trunk

Fixes: a1d477c24c ("OpenZFS 7614, 9064 - zfs device evacuation/removal")
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13304

2 years agotests: cmd: draid: remove unused and undocumented -v
наб [Thu, 7 Apr 2022 02:25:05 +0000 (04:25 +0200)]
tests: cmd: draid: remove unused and undocumented -v

Found with -Wunused-but-set-variable on Clang trunk

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13304

2 years agozfs(8): remove errors reported by mandoc 1.14.6
szubersk [Mon, 11 Apr 2022 12:49:08 +0000 (14:49 +0200)]
zfs(8): remove errors reported by mandoc 1.14.6

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #13315

2 years agozfs(8): add requirements towards fs names
szubersk [Mon, 11 Apr 2022 13:14:38 +0000 (15:14 +0200)]
zfs(8): add requirements towards fs names

Provide explicit requirements towards file system naming convention
in OpenZFS man pages.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Mitigates #13310
Closes #13315

2 years agoZTS: Retry auto_spare_multiple.ksh
Brian Behlendorf [Tue, 12 Apr 2022 00:26:01 +0000 (17:26 -0700)]
ZTS: Retry auto_spare_multiple.ksh

The auto_spare_multiple.ksh test may incorrectly fail for a similar
reason as the auto_spare_shared.ksh test.  Add it to known list of
exceptions which should be retried to prevent failures in the CI.

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

2 years agoZTS: Retry redundancy_draid_spare[1,3].ksh
Brian Behlendorf [Mon, 11 Apr 2022 23:18:51 +0000 (16:18 -0700)]
ZTS: Retry redundancy_draid_spare[1,3].ksh

The redundancy_draid_spare1.ksh and redundancy_draid_spare3.ksh test
cases are a little to strict for the sequential resilver case.  While
unlikely it is possible that a handful of correctable checksum errors
will be reported resulting in a test failure.  Update the zts-report.py
script to allow this the test case to be retried if requested.

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

2 years agoFreeBSD: Return Mach error codes from VOP_(GET|PUT)PAGES
Mark Johnston [Thu, 7 Apr 2022 21:13:18 +0000 (17:13 -0400)]
FreeBSD: Return Mach error codes from VOP_(GET|PUT)PAGES

FreeBSD's memory management system uses its own error numbers and gets
confused when these VOPs return EIO.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reported-by: Peter Holm <pho@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #13311

2 years agoFreeBSD: Parameterize ZFS_ENTER/ZFS_VERIFY_VP with an error code
Mark Johnston [Thu, 7 Apr 2022 21:11:00 +0000 (17:11 -0400)]
FreeBSD: Parameterize ZFS_ENTER/ZFS_VERIFY_VP with an error code

For legacy reasons, a couple of VOPs have to return error numbers that
don't come from the usual errno namespace.  To handle the cases where
ZFS_ENTER or ZFS_VERIFY_ZP fail, we need to be able to override the
default error return value of EIO.  Extend the macros to permit this.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #13311

2 years agoinitramfs: use `mount.zfs` instead of `mount`
Damian Szuberski [Mon, 11 Apr 2022 22:51:23 +0000 (00:51 +0200)]
initramfs: use `mount.zfs` instead of `mount`

A followup to d7a67402a85252e163aa8a9b69e7eda499db8c61

For `mount -t zfs -o opts ds mp` command line
some implementations of `mount(8)`, e. g. Busybox in Debian
work as follows:

```
newfstatat(AT_FDCWD, "ds", 0x7fff826f4ab0, 0) = -1
mount("ds", "mp", "zfs", MS_SILENT, NULL) = 0
```

The logic above skips completely `mount.zfs` and prevents us
from reading filesystem properties and applying mount options.

For comparison, the coreutils `mount(8)` implementation does:

```
openat(AT_FDCWD, "/proc/filesystems", O_RDONLY|O_CLOEXEC) = 3
// figure out that zfs is a `nodev` filesystem and look for a helper
newfstatat(AT_FDCWD, "/sbin/mount.zfs" ...) = 0
execve("/sbin/mount.zfs" ...) = 0
```

Using `mount.zfs` in initramfs would help circumvent deficiencies
of some of `mount(8)` implementations. `mount -t zfs` translates
to `mount.zfs` invocation, except for cases when explicitly disabled
by `-i`.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #13305

2 years agocmd: zed: rc: drop "should be owned by root and 0600"
наб [Tue, 5 Apr 2022 20:50:55 +0000 (22:50 +0200)]
cmd: zed: rc: drop "should be owned by root and 0600"

It doesn't matter, 0600 are Weird Permissions, and it's even weirder to
spec them for no reason ‒ it's perfectly fine if it's the usual 0:0 644,
or literally anything else, so long as unprivileged users can't edit it
(which (a) 644 accomplishes and (b) is at the administrator's
 discretion, it's not unheard of to have adm users and having it
 be 664 in that case is just as good; it's not our place to say)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12544
Closes #13276

2 years agoPrefer ATTR_ in shared codebase over AT_
Jorgen Lundman [Tue, 5 Apr 2022 20:02:17 +0000 (05:02 +0900)]
Prefer ATTR_ in shared codebase over AT_

An earlier commit introduces AT_MODE into the shared kernel sources,
instead of the preferred existing ATTR_MODE use.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Jorgen lundman <lundman@lundman.net>
Closes #13293

2 years agolibzfs: sendrecv: use common progress thread killer
наб [Mon, 4 Apr 2022 13:19:12 +0000 (15:19 +0200)]
libzfs: sendrecv: use common progress thread killer

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13284

2 years agolibzfs: sendrecv: always cancel progress thread in zfs_send_one()
наб [Mon, 4 Apr 2022 12:25:01 +0000 (14:25 +0200)]
libzfs: sendrecv: always cancel progress thread in zfs_send_one()

This is in line with all the other uses of the progress thread

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11560
Closes #13284

2 years agoForbid asctime{,_r}(), gmtime(), localtime()
наб [Mon, 4 Apr 2022 12:07:36 +0000 (14:07 +0200)]
Forbid asctime{,_r}(), gmtime(), localtime()

ctime() is only used in binary main threads, which is fine

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13284

2 years agolibspl: zed: event: use localtime_r()
наб [Mon, 4 Apr 2022 12:07:26 +0000 (14:07 +0200)]
libspl: zed: event: use localtime_r()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13284