Commit graph

1463 commits

Author SHA1 Message Date
Christos Margiolis 2179a159ea libdtrace: Add kinst support
kinst does not instantiate its probes automatically, it only does so on
demand via an ioctl interface implemented by /dev/kinst.  This change
modifies libdtrace to perform that work when the script references the
kinst provider, similar to the way pid provider probes are implemented.

Reviewed by:	markj
MFC after:	3 months
Sponsored by:	Google, Inc. (GSoC 2022)
Differential Revision:	https://reviews.freebsd.org/D36852
2022-10-11 18:19:08 -04:00
Mark Johnston bdd101c4d4 dtrace: Add a "regs" variable
This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired.  It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers.  It's not clear what
semantics "regs" should have for them anyway.

This is akin to "uregs", which nominally provides access to the
userspace registers.  In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.

Usage example: print the contents of %rdi upon each call to
amd64_syscall():

    fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}

Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.

Reviewed by:	christos
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36799
2022-10-04 13:05:54 -04:00
John Baldwin e67b246734 libzpool: Disable -Wuse-after-free for dbuf.c.
The debug traces for reference counting in ZFS use the pointer of the
owning object as a "tag" for references to check that when an object
drops a reference it had actually held one.  In a couple of places ZFS
drops references after freeing the owning object.  In userland GCC
realizes this is a use after free.  However, since only the value of
the pointer is used, and it isn't indirected, the use is harmless.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36818
2022-10-03 16:10:43 -07:00
Martin Matuska c7046f76c2 zfs: merge openzfs/zfs@c629f0bf6
Notable upstream pull request merges:
  #13725 Fix BLAKE3 tuneable and module loading on Linux and FreeBSD
  #13756 FreeBSD: Organize sysctls
  #13773 FreeBSD: add kqfilter support for zvol cdev
  #13781 Importing from cachefile can trip assertion
  #13794 Apply arc_shrink_shift to ARC above arc_c_min
  #13798 Improve too large physical ashift handling
  #13799 Revert "Avoid panic with recordsize > 128k, raw sending and
         no large_blocks"
  #13802 Add zfs.sync.snapshot_rename
  #13831 zfs_enter rework
  #13855 zfs recv hangs if max recordsize is less than received
         recordsize

Obtained from:	OpenZFS
OpenZFS commit:	c629f0bf62
2022-09-21 14:17:13 +02:00
Jens Schweikhardt 7c20397b72 In man page cross refs to sudo, indicate it comes from ports/security/sudo. 2022-08-14 11:44:43 +02:00
Mark Johnston 6237c3e74f ctfconvert: Actually use the asprintf() helper
Fixes:	1165fc9a52 ("ctfconvert: Give bitfield types names distinct from the base type")
2022-08-02 20:49:50 -04:00
Mark Johnston 1165fc9a52 ctfconvert: Give bitfield types names distinct from the base type
CTF integers have an explicit width and so can be used to represent
bitfields.  Bitfield types emitted by ctfconvert(1) share the name of
the base integer type, so a struct field with type "unsigned int : 15"
will have a type named "unsigned int".

To avoid ambiguity when looking up types by name, add a suffix to names
of bitfield types to distinguish them from the base type.  Then, if
ctfmerge happens to order bitfield types before the corresponding base
type in a CTF file, a name lookup will return the base type, which is
always going to be the desired behaviour.

PR:		265403
Reported by:	cy
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-08-02 20:32:17 -04:00
Mark Johnston 6a05f14381 dtrace tests: Rename some test type names to avoid a conflict
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-08-02 20:32:08 -04:00
Mark Johnston e1700a36a9 dtrace tests: Override RLIMIT_CORE for a test which triggers a core dump
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-08-02 20:32:04 -04:00
Kristof Provost 06016a40d6 libnvpair: install libnvpair.h
This is included by libbe/be.h.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-21 18:36:01 +02:00
Martin Matuska a0b956f5ac zfs: merge openzfs/zfs@cb01da680
Notable upstream pull request merges:
  #12438 Avoid panic with recordsize > 128k, raw sending and no large_blocks
  #13015 Fix dnode byteswapping
  #13256 Add a "zstream decompress" subcommand
  #13555 Scrub mirror children without BPs
  #13576 Several sorted scrub optimizations
  #13579 Fix and disable blocks statistics during scrub
  #13582 Several B-tree optimizations
  #13591 Avoid two 64-bit divisions per scanned block
  #13606 Avoid memory copies during mirror scrub
  #13613 Avoid memory copy when verifying raidz/draid parity

Obtained from:	OpenZFS
OpenZFS commit:	cb01da6805
2022-07-08 00:02:36 +02:00
Brooks Davis 3bf6636512 cddl/*: add a WITH(OUT)_DTRACE option
Add an option to enable/disable DTrace without disabling ZFS.  New
architectures such as CHERI may support ZFS before they support DTrace
and the old model of WITHOUT_CDDL disabling both wasn't helpful.

For compatiblity, the CDDL option remains and WITHOUT_CDDL implies
WITHOUT_DTRACE.  WITHOUT_DTRACE also implies WITHOUT_CTF.

As part of this change, largely convert cddl/*/Makefile to using the
more compact SUBDIR.${MK_<FOO>}+= form rather than using intermediate
variables.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35718
2022-07-06 14:03:48 +01:00
Kornel Dulęba 9dbacce2d4 lockstat: Fix construction of comparision predicates
Passing "0x%p" to sprintf results in double "0x" being printed.
This causes a dtrace script compilation failure when "-d" flag
is specified.
Fix that by removing the extraneous "0x".

Reviewed by:	markj
Approved by:	mw(mentor)
Obtained from:	Semihalf
Sponsored by:	Alstom
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35690
2022-07-04 16:22:22 +02:00
Brooks Davis 711d50bd9e dtrace: Remove local mips support
Remove the stub pid probe and all the build glue.

Reviewed by:	imp, jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35541
2022-07-01 08:33:17 +01:00
Jessica Clarke b0a8333a88 libicp_rescue: Fix build for powerpc64le
This is a repeat of 13cee53cef35 ("libicp: Fix build for powerpc64le")
but for the rescue version of the library.

Fixes:	1f1e2261e3 ("zfs: merge openzfs/zfs@deb121309")
2022-07-01 04:28:15 +01:00
Jessica Clarke 9921563f43 libicp: Fix build for powerpc64le
The C sources use the assembly routines for little-endian powerpc64, and
the assembly files have ppc64le in their names, but the guard here was
for big-endian powerpc64.

Fixes:	1f1e2261e3 ("zfs: merge openzfs/zfs@deb121309")
2022-07-01 01:30:26 +01:00
Martin Matuska 1f1e2261e3 zfs: merge openzfs/zfs@deb121309
Notable upstream pull request merges:
  #12918 Introduce BLAKE3 checksums as an OpenZFS feature
  #13553 Reduce ZIO io_lock contention on sorted scrub
  #13537 Improve sorted scan memory accounting
  #13540 AVL: Remove obsolete branching optimizations
  #13563 FreeBSD: Improve crypto_dispatch() handling

Obtained from:	OpenZFS
OpenZFS commit:	deb1213098
2022-06-23 17:49:33 +02:00
Martin Matuska e3aa18ad71 zfs: merge openzfs/zfs@b9d98453f
Notable upstream pull request merges:
  #12321 Fix inflated quiesce time caused by lwb_tx during zil_commit()
  #13244 zstd early abort
  #13360 Verify BPs as part of spa_load_verify_cb()
  #13452 More speculative prefetcher improvements
  #13466 Expose zpool guids through kstats
  #13476 Refactor Log Size Limit
  #13484 FreeBSD: libspl: Add locking around statfs globals
  #13498 Cancel in-progress rebuilds when we finish removal
  #13499 zed: Take no action on scrub/resilver checksum errors
  #13513 Remove wrong assertion in log spacemap

Obtained from:	OpenZFS
OpenZFS commit:	b9d98453f9
2022-06-03 18:17:53 +02:00
Martin Matuska 716fd348e0 zfs: merge openzfs/zfs@c0cf6ed67
Notable upstream pull request merges:
  #10662 zvol_wait: Ignore locked zvols
  #12789 Improve log spacemap load time
  #12812 Improved zpool status output, list all affected datasets
  #13277 FreeBSD: Use NDFREE_PNBUF if available
  #13302 Make zfs_max_recordsize default to 16M
  #13311 Fix error handling in FreeBSD's get/putpages VOPs
  #13345 FreeBSD: Fix translation from ABD to physical pages
  #13373 zfs: holds: dequadratify
  #13375 Corrected edge case in uncompressed ARC->L2ARC handling
  #13388 Improve mg_aliquot math
  #13405 Reduce dbuf_find() lock contention
  #13406 FreeBSD: use zero_region instead of allocating a dedicated page

Obtained from:	OpenZFS
OpenZFS commit:	c0cf6ed679
2022-05-19 00:55:59 +02:00
Mark Johnston 5727eceabc ctf: Link CTF toolchain man pages to ctf.5
Also expand the CTF acronym to provide a bit of context.

PR:		259790
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-04-21 11:20:28 -04:00
Mark Johnston 45dd2eaac3 ctfdump: Remove definitions of warn() and vwarn()
The presence of the latter causes a link error when building a
statically linked ctfdump(1) because libc defines the same symbol.
libc's warn() is defined as a weak symbol and so does not cause the same
problem, but let's just use libc's version.

Reported by:	stephane rochoy <stephane.rochoy@stormshield.eu>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-04-21 11:18:53 -04:00
Mark Johnston 6e563a1b60 libctf: Fix recursive descent into anonymous SOU fields
PR:		262412
Tested by:	dhw, gallatin
Fixes:		a6fb869173 ("libctf: Handle CTFv3 containers")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-04-12 17:29:53 -04:00
Li-Wen Hsu 0088bc444e
DTrace test: skip flakey common.misc.t_dtrace_contrib.tst_dynopt_d in CI
PR:		237641
Sponsored by:	The FreeBSD Foundation
2022-03-24 11:37:50 +08:00
Li-Wen Hsu e62aee66b0
DTrace test: Add a new keyword SKIPCI to gentest.sh
This is for marking a test case is flakey and should not be executed in
the CI environment.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34635
2022-03-24 11:30:27 +08:00
Li-Wen Hsu 16e02ae401
dtrace tests: Fix expected outout for tst.system.d
This is follow up of d500a85e64

PR:		262415
Sponsored by:	The FreeBSD Foundation
2022-03-09 11:39:12 +08:00
Martin Matuska c03c5b1c80 zfs: merge openzfs/zfs@a86e08941 (master) into main
Notable upstream pull request merges:
  #9078:  log xattr=sa create/remove/update to ZIL
  #11919: Cross-platform xattr user namespace compatibility
  #13014: Report dnodes with faulty bonuslen
  #13016: FreeBSD: Fix zvol_cdev_open locking
  #13019: spl: Don't check FreeBSD rwlocks for double initialization
  #13027: Fix clearing set-uid and set-gid bits on a file when
          replying a write
  #13031: Add enumerated vdev names to 'zpool iostat -v' and
          'zpool list -v'
  #13074: Enable encrypted raw sending to pools with greater ashift
  #13076: Receive checks should allow unencrypted child datasets
  #13098: Avoid dirtying the final TXGs when exporting a pool
  #13172: Fix ENOSPC when unlinking multiple files from full pool

Obtained from:	OpenZFS
OpenZFS commit:	a86e089415
2022-03-08 18:53:02 +01:00
Mark Johnston 3fe1f21fb3 ctf: Avoid passing a caddr_t to roundup2()
For some reason I can't reproduce this locally, but Jenkins complains.

Reported by:	Jenkins
Fixes:		bdf290cd3e ("ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}")
2022-03-07 11:20:57 -05:00
Mark Johnston cb6f722562 ctf: Fix a -Wunused-but-set-variable warning
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2022-03-07 10:43:19 -05:00
Mark Johnston bdf290cd3e ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}
ctfdump handles v2 and v3.  ctfconvert now emits only CTFv3, whereas
ctfmerge can merge v2 and v3 containers into v3 containers.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34364
2022-03-07 10:43:19 -05:00
Mark Johnston a6fb869173 libctf: Handle CTFv3 containers
In general, the patch adds indirection to minimize the amount of code
that needs to know about differences between v2 and v3.  Specifically,
some new ctf_get_ctt_* functions are added, and new LCTF_* macros are
added to use the underlying container's version to do the right thing.

CTF containers can have parent/child relationships, wherein a type ID in
one container refers to a type in the parent.  It is permitted for the
parent and child to have different versions.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34363
2022-03-07 10:43:19 -05:00
Mark Johnston 994297b01b ctf: Add definitions for CTFv3
These are based on definitions added to binutils' libctf.  Specifically:
- Type IDs are now encoded in 32 bits rather than 16, changing the
  layout of ctf_type_t, ctf_array_t, ctf_member_t and ctf_lmember_t.
- Type info is encoded in 32 bits rather than 16.  The type "kind" is
  extended from 5 bits to 6, and the type "vlen" is extended from 10
  bits to 25.

The main upside is that we remove the current limit, imposed by CTFv2,
of 2^{15} distinct types in the main kernel executable.  Other limits,
such as that on the number of elements in an enum, imposed by the vlen
limit, are also raised.

This change adds v2 and v3 flavours of macros and type definitions which
differ between the two versions.  Compatibility is preserved for now by
having generic names refer to the v2 definitions, so, e.g., ctf_type_t
is still a v2 type.

No functional change intended.

Reviewed by:	Domagoj Stolfa
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34360
2022-03-07 10:43:18 -05:00
Mark Johnston 2d5d2a986c ctf: Import ctf.h from OpenBSD
Use it instead of the existing ctf.h from OpenSolaris.  This makes it
easier to use CTF in the core kernel, and to extend the CTF format to
support wider type IDs.

The imported ctf.h is modified to depend only on _types.h, and also to
provide macros which use the "parent" bit of a type ID to refer to types
in a parent CTF container.

No functional change intended.

Reviewed by:	Domagoj Stolfa, emaste
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34358
2022-03-07 10:43:18 -05:00
Mark Johnston 45c23c2608 libctf: Use const ctf_file_t references in string lookup routines
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-23 18:43:51 -05:00
Mark Johnston 1ef441f699 libdtrace: Add a missing newline to an error message
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-23 11:41:23 -05:00
Mark Johnston 565518046c libctf: Remove checks for CTFv1
Per commit 7db423d692 ("libctf: Rip out CTFv1 support") this support
is obsolete.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-23 11:41:22 -05:00
Mark Johnston 7be9a3b453 ctfconvert: Rip out STABS support
It is unused on FreeBSD and complicates some efforts to modify the CTF
format to permit wider type IDs, so remove it.  No functional change
intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-10 15:41:10 -05:00
Mark Johnston 7db423d692 libctf: Rip out CTFv1 support
CTFv1 was obsolete before libctf was imported into FreeBSD, and
ctfconvert/ctfmerge can emit only CTFv2.  Make ctf.h a bit easier to
maintain by ripping v1 support out.  No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-10 15:39:59 -05:00
Mark Johnston 2e4311906d libctf: Use ctf_type_t instead of struct ctf_type
For consistency with other CTF toolchain code.  No functional change
intended.

Fixes:	105fd928b0 ("libctf: Improve check for duplicate SOU definitions in ctf_add_type()")
MFC after:	1 week
2022-02-10 13:21:37 -05:00
Chuck Silvers f339a3ef63 dtrace: remove unnecessary fflush()
This call was added back in the early days of dtrace porting and
no one knows why anymore.  The extra flushing causes lots of
unnecessary CPU overhead when a script produces lots of output,
as well as easily losing output because the command can't keep up.

Sponsored by:	Netflix
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D34216
2022-02-09 17:09:26 -08:00
Dimitry Andric 5f2aca8394 Disable clang 14 warning about bitwise operators in zstd
Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after:	3 days
2022-02-08 21:46:08 +01:00
Martin Matuska e92ffd9b62 zfs: merge openzfs/zfs@17b2ae0b2 (master) into main
Notable upstream pull request merges:
  #12766 Fix error propagation from lzc_send_redacted
  #12805 Updated the lz4 decompressor
  #12851 FreeBSD: Provide correct file generation number
  #12857 Verify dRAID empty sectors
  #12874 FreeBSD: Update argument types for VOP_READDIR
  #12896 Reduce number of arc_prune threads
  #12934 FreeBSD: Fix zvol_*_open() locking
  #12947 lz4: Cherrypick fix for CVE-2021-3520
  #12961 FreeBSD: Fix leaked strings in libspl mnttab
  #12964 Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
  #12981 Introduce a flag to skip comparing the local mac when raw sending
  #12985 Avoid memory allocations in the ARC eviction thread

Obtained from:	OpenZFS
OpenZFS commit:	17b2ae0b24
2022-01-22 23:05:15 +01:00
Andriy Gapon 256c8c5df2 dt_unring_buf: set dtbd_oldest to the start of the first record
It was set to the start of the buffer and that can be different from the
start of teh first record because of a misalignment.

This change follows the example of dt_realloc_buf().

Reviewed by:	tsoome, markj
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D33649
2022-01-11 15:44:04 +02:00
Mark Johnston 963f5dc7a3 ctfconvert: Handle arrays of empty structs
Members with such a type will legitimately have a size of zero, so don't
emit a warning.

PR:		260818
Reviewed by:	bz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33700
2021-12-31 12:55:01 -05:00
Domagoj Stolfa 30ec3138ed dtrace: Disable getf() as it is broken on FreeBSD
getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked().
Furthermore, it does not set the per-core fault flag, meaning it
usually ends up in a double fault panic once getf() does get called,
especially from fbt.

Reviewing the DTrace Toolkit + a number of other scripts scattered
around FreeBSD, I have not been able to find one use of getf(). Given
how broken the implementation currently is, we disable it until it
can be implemented properly.

Also comment out a test in aggs/tst.subr.d for getf().

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33378
2021-12-17 13:10:22 -05:00
Greg V 9e9c651cac cddl: fix missing ZFS library dependencies
In 9fae47666 zfsd got a libspl dependency to avoid undefined references.
However that workaround did not help external consumers of libzfs_core.

Fix all missing dependencies lld 13 and the rtld complain about.

Reviewed by:	freqlabs, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D32521
2021-11-15 09:42:07 -05:00
Martin Matuska 6ba2210ee0 zfs: merge openzfs/zfs@ec64fdb93 (master) into main
Notable upstream pull request merges:
  #12392 Avoid panic in case of pool errors and missing L2ARC
  #12448 skip snapshot in zfs_iter_mounted()
  #12516 Fix NFS and large reads on older kernels
  #12533 Fail invalid incremental recursive send gracefully
  #12569 FreeBSD: Really zero the zero page
  #12575 Reject zfs send -RI with nonexistent fromsnap
  #12602 Correct refcount_add in dmu_zfetch
  #12650 zpool should call zfs_nicestrtonum() with non-NULL handle

Obtained from:	OpenZFS
OpenZFS commit:	ec64fdb93d
2021-10-21 15:06:06 +02:00
Mark Johnston 105fd928b0 libctf: Improve check for duplicate SOU definitions in ctf_add_type()
When copying a struct or union from one CTF container to another,
ctf_add_type() checks whether it matches an existing type in the
destination container.  It does so by looking for a type with the same
name and kind as the new type, and if one exists, it iterates over all
members of the source type and checks whether a member with matching
name and offset exists in the matched destination type.  This can
produce false positives, for example because member types are not
compared, but this is not expected to arise in practice.  If the match
fails, ctf_add_type() returns an error.

The procedure used for member comparison breaks down in the face of
anonymous struct and union members.  ctf_member_iter() visits each
member in the source definition and looks up the corresponding member in
the desination definition by name using ctf_member_info(), but this
function will descend into anonymous members and thus fail to match.
Fix the problem by introducing a custom comparison routine which does
not assume member names are unique.  This should also be faster for
types with many members; in the previous scheme, membcmp() would perform
a linear scan of the desination type's members to perform a lookup by
name.  The new routine steps through the members of both types in a
single loop.

PR:		258763
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-10-04 12:28:22 -04:00
Mark Johnston a40c4ae866 dtrace.1: Document a couple of preprocessor-related options
Suggested by:	swills
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-09-07 14:04:50 -04:00
Mark Johnston 13d9437a60 dtrace.1: Document -x ldpath
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-09-07 11:19:29 -04:00
Emmanuel Vadot a3266ba269 pkgbase: Create a FreeBSD-dwatch package
While dwatch is useful some users might not want it by default.
Create a package for it.

Differential Revision:	https://reviews.freebsd.org/D31796
2021-09-07 10:20:40 +02:00
Dimitry Andric 9fae476669 Explicitly link zfsd with libspl to avoid undefined references
Because lld 13.0.0 is more strict about undefined references when
linking to shared libraries, it produces the following errors for zfsd:

ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libzfs_core.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libnvpair.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libavl.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
*** [zfsd.full] Error code 1

Fix this by adding libspl (where libspl_assertf lives) to zfsd's LIBADD.

MFC after:	3 days
2021-08-28 20:23:28 +02:00
Martin Matuska 48b4fe0503 zfs: attach zpool_influxdb to build
From the zpool_influxdb.8 manual page:
  zpool_influxdb produces InfluxDB-line-protocol-compatible metrics from
  zpools.  Like the zpool command, zpool_influxdb reads the current pool
  status and statistics.  Unlike the zpool command which is intended for
  humans, zpool_influxdb formats the output in the InfluxDB line protocol.
  The expected use is as a plugin to a metrics collector or aggregator,
  such as Telegraf.

zpool_influxdb is installed into /usr/libexec/zfs/

Differential revision:	https://reviews.freebsd.org/D31094
MFC after:	3 days
2021-07-07 20:15:12 +02:00
Ryan Moeller 53b438b242 zfsd: Check for error from zpool_vdev_online
Onlining a vdev can fail. Log the error if it does.

Reviewed by:	mav, asomers
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D30882
2021-07-06 16:00:18 +00:00
Emmanuel Vadot 79ac3c12a7 pkgbase: Put dtrace in its own package
While dtrace is usefull some people might not want it.

Differential Revision:	https://reviews.freebsd.org/D30752
Sponsored by:	Diablotin Systems
2021-06-19 17:49:31 +02:00
Domagoj Stolfa a877965fa3 dtrace: fix an out of bound read and a NULL pointer increment
In dt_cc.c when the provider is an empty string, accessing
strlen(pdp->dtpd_provider) - 1 will result in a pdp->dtpd_provider[-1]
access.

Similarly, in dt_ident.c, if p2 is a NULL pointer, doing a p2++ on it is
undefined behaviour.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Google
Differential Revision:	https://reviews.freebsd.org/D30778
2021-06-17 13:52:32 -04:00
Jessica Clarke d5c1296234 spl: Unbreak crossbuild after f20893853e
Summary:
f20893853e made getexecname no longer guarded by BOOTSTRAPPING, but it
does not build on non-FreeBSD as it tries to use KERN_PROC_PATHNAME and
related constants.

Reviewers: mm, imp

Reviewed By: imp

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D30763
2021-06-15 01:23:04 +01:00
Martin Matuska 44877c8db0 zfs: change zstream -> zstreamdump link into a symlink 2021-06-13 05:40:18 +02:00
Martin Matuska 3ff01b231d zfs: merge openzfs/zfs@afa7b3484 (master) into main
Notable upstream pull request merges:
  #12149: Multiple man-pages: Move to appropriate section
  #12158: Re-embed multilist_t storage
  #12191: Convert non-libzpool libraries to -fvisibility=hidden
  #12196: Unify manpage makefiles, move pages to better sexions, ...
  #12210: libzutil: import filtering optimisation
  #12212: Remove pool io kstats

Obtained from:	OpenZFS
OpenZFS commit:	afa7b34845
2021-06-13 04:38:47 +02:00
Warner Losh 7aa2e90176 spl: Fix gcc6 build
-Wno-error= is only a clang flag, restrict its use to only clang.

Sponsored by:		Netflix
2021-06-10 21:28:52 -06:00
Martin Matuska 47ddbfae27 zfs: unbreak build with clang 12
Change -Wno-error-atomic-alignment to -Wno-error=atomic-alignment
in the Makefile of libspl.

Reported by:	Ed Maste <emaste@FreeBSD.org>
Fix by:		Alexander Richardson <arichardson@FreeBSD.org>
2021-06-11 01:34:46 +02:00
Martin Matuska f20893853e zfs: unbreak build broken in 160388166 2021-06-08 22:21:11 +02:00
Martin Matuska 1603881667 zfs: merge openzfs/zfs@75b4cbf62 (master) into main
Notable upstream pull request merges:
  #11710 Allow zfs to send replication streams with missing snapshots
  #11751 Avoid taking global lock to destroy zfsdev state
  #11786 Ratelimit deadman zevents as with delay zevents
  #11803 ZFS traverse_visitbp optimization to limit prefetch
  #11813 Allow pool names that look like Solaris disk names
  #11822 Atomically check and set dropped zevent count
  #11822 Don't scale zfs_zevent_len_max by CPU count
  #11833 Refactor zfsdev state init/destroy to share common code
  #11837 zfs get -p only outputs 3 columns if "clones" property is empty
  #11843 libzutil: zfs_isnumber(): return false if input empty
  #11849 Use dsl_scan_setup_check() to setup a scrub
  #11861 Improvements to the 'compatibility' property
  #11862 cmd/zfs receive: allow dry-run (-n) to check property args
  #11864 receive: don't fail inheriting (-x) properties on wrong dataset type
  #11877 Combine zio caches if possible
  #11881 FreeBSD: use vnlru_free_vfsops if available
  #11883 FreeBSD: add support for lockless symlink lookup
  #11884 FreeBSD: add missing seqc write begin/end around zfs_acl_chown_setattr
  #11896 Fix crash in zio_done error reporting
  #11905 zfs-send(8): Restore sorting of flags
  #11926 FreeBSD: damage control racing .. lookups in face of mkdir/rmdir
  #11930 vdev_mirror: don't scrub/resilver devices that can't be read
  #11938 Fix AVX512BW Fletcher code on AVX512-but-not-BW machines
  #11955 zfs get: don't lookup mount options when using "-s local"
  #11956 libzfs: add keylocation=https://, backed by fetch(3) or libcurl
  #11959 vdev_id: variable not getting expanded under map_slot()
  #11966 Scale worker threads and taskqs with number of CPUs
  #11994 Clean up use of zfs_log_create in zfs_dir
  #11997 FreeBSD: Don't force xattr mount option
  #11997 FreeBSD: Implement xattr=sa
  #11997 FreeBSD: Use SET_ERROR to trace xattr name errors
  #11998 Simplify/fix dnode_move() for dn_zfetch
  #12003 FreeBSD: Initialize/destroy zp->z_lock
  #12010 Fix dRAID self-healing short columns
  #12033 Revert "Fix raw sends on encrypted datasets when copying back snapshots"
  #12040 Reinstate the old zpool read label logic as a fallback
  #12046 Improve scrub maxinflight_bytes math
  #12049 FreeBSD: avoid memory allocation in arc_prune_async
  #12052 FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI
  #12061 Fix dRAID sequential resilver silent damage handling
  #12072 Let zfs diff be more permissive
  #12077 FreeBSD: Retry OCF ENOMEM errors.
  #12088 Propagate vdev state due to invalid label corruption
  #12091 libzfs: On FreeBSD, use MNT_NOWAIT with getfsstat
  #12097 FreeBSD: Update dataset_kstats for zvols in dev mode
  #12104 FreeBSD boot code reminder after zpool upgrade
  #12114 Introduce write-mostly sums

Obtained from:	OpenZFS
OpenZFS commit:	75b4cbf625
2021-06-08 16:52:44 +02:00
Alan Somers fc3ba3e9fa Delete obsolete Solaris compat files
These files have been unused ever since the OpenSolaris import

Sponsored by:	Axcient
MFC after:	2 weeks
Reviewed By:	freqlabs
Differential Revision: https://reviews.freebsd.org/D30371
2021-05-24 08:48:47 -06:00
Mark Johnston d500a85e64 dtrace tests: Fix tst.system.d after ping/ping6 unification
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-04-23 10:28:09 -04:00
Domagoj Stolfa 7653f9317b dtrace: Document the libdir, nolibs and syslibdir options
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29541
2021-04-02 17:42:38 -04:00
Mark Johnston 3c065eeaa7 libctf: Adjust logic to match upstream after 410556f1f
No functional change intended.

Suggested by:	jrtc27
MFC after:	1 week
2021-03-27 20:37:12 -04:00
Domagoj Stolfa 410556f1f1 libctf: Fix an out-of-bounds read in ctf_lookup_by_name()
When prefixes such as struct, union, etc. are compared with the current
type (e.g. struct foo), a comparison is made with the prefix.  The code
currently assumes that every type is a valid C type with a prefix,
however at times, garbage ends up in this function causing an
unpredictable crash with DTrace due to the isspace(*p) call or
subsequent calls. An example that I've seen of this is the letter 's'
being passed in, comparing true with struct as the comparison size was
(q - p) == 1, but then we increment p with the length of "struct",
resulting in an out of bounds read.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29435
2021-03-27 14:04:12 -04:00
Emmanuel Vadot b5fc9e350c pkgbase: Move libicp in utilities
libicp is used by zdb zhack zinject zstream ztest libzpool.so.2 which
are all in FreeBSD-utilities.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D29164
MFC after:	2 weeks
2021-03-16 07:12:40 +01:00
Greg V ee21ee1572 openzfs: attach pam_zfs_key to build
This PAM module allows unlocking encrypted user home datasets when
logging in (and changing passphrase when changing the account password),
see https://github.com/openzfs/zfs/pull/9903

Also supposed to unload the key when the last session for the user is
done, but there are EBUSY issues:
https://github.com/openzfs/zfs/issues/11222#issuecomment-731897858

Submitted by:	Greg V <greg_unrelenting.technology>
Reviewed by:	mm
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28018
2021-03-02 07:26:59 -05:00
Ryan Moeller 2ae79aa362 Install links for zpool feature compat aliases
The alias links were missed when this feature was introduced to the
FreeBSD build system in 10f57cb98f.

Reviewed by:	mm
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D28925
2021-02-25 14:16:09 -05:00
Martin Matuska ba27dd8be8 zfs: merge OpenZFS master-9312e0fd1
Notable upstream changes:
  778869fa1 Fix reporting of mount progress
  e7adccf7f Disable use of hardware crypto offload drivers on FreeBSD
  03e02e5b5 Fix checksum errors not being counted on repeated repair
  64e0fe14f Restore FreeBSD resource usage accounting
  11f2e9a49 Fix panic if scrubbing after removing a slog device

MFC after:	2 weeks
2021-02-22 13:01:17 +01:00
Mark Johnston 150fc89a12 libdtrace: Trivial style fixes to force dt_lex.c to be regenerated
After commit 8ba333e02e ("libdtrace: Stop relying on lex
compatibility"), there have been several reports of incremental
buildworlds failing since make does not know that dt_lex.c needs to be
regenerated, and I want to avoid this when merging to stable/13.

MFC with:	8ba333e02e
2021-02-19 21:51:18 -05:00
Martin Matuska 10f57cb98f zfs: bump version and install new share files
- bump version to 2.0.0-FreeBSD_gbf156c966
- install definition files for the new "-o compatibility" option
  to "zpool create"

MFC after:	2 weeks
2021-02-18 15:21:10 +01:00
Mark Johnston 8ba333e02e libdtrace: Stop relying on lex compatibility
It does not appear to be required, and as of commit 6b7e592c21
("lex: Do not let input() return 0 when end-of-file is reached") it
causes input to return 0 instead of EOF when end-of-input is reached.

PR:		253440
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2021-02-17 10:57:19 -05:00
Martin Matuska 184c1b9439 zfs: merge OpenZFS master-436ab35a5
- speed up writing to ZFS pools without ZIL devices (aa755b3)
- speed up importing ZFS pools (2d8f72d, a0e0199, cf0977a)
...

MFC after:		2 weeks
Reviewed by:		mjg (partial)
Tested by:		pho
Differential Revision:	https://reviews.freebsd.org/D28677
2021-02-16 02:46:28 +01:00
Kyle Evans 123ae3045d build: remove LIBPTHREAD/LIBTHR build options
WITHOUT_LIBTHR has been broken for a little over five years now, since the
xz 5.2.0 update introduced a hard liblzma dependency on libthr, and building
a useful system without threading support is becoming increasingly more
difficult.

Additionally, in the five plus years that it's been broken more reverse
dependencies have cropped up in libzstd, libsqlite3, and libcrypto (among
others) that make it more and more difficult to reconcile the effort needed
to fix these options.

Remove the broken options.

PR:		252760
Reviewed by:	brooks, emaste, kib
Differential Revision:	https://reviews.freebsd.org/D28263
2021-01-22 12:33:27 -06:00
Ryan Libby c14e17a49c dtrace tests: fix prototypes for gcc build
- quiet -Wstrict-prototypes
 - provide prototypes for weak aliases

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D28036
2021-01-10 21:53:15 -08:00
Mark Johnston d00431a7bd libdtrace: Format USDT symbols correctly based on symbol binding
Before we did not handle weak symbols correctly, sometimes resulting in
link errors from dtrace -G when processing object files where functions
with weak aliases contain USDT probes.

Reported by:	rlibby
Tested by:	rlibby
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-01-10 17:58:38 -05:00
Matt Macy b363d3d52a OpenZFS: Fix issues caused by reversed commits + rebase 2021-01-07 17:42:10 -08:00
Alex Richardson 1f6612b444 Install dtrace.h and dependencies
This makes the minimum amount of changes to allow inclusion of dtrace.h
without all the solaris compatibility headers. Installing dtrace.h allows
compiling consumers of libdtrace (e.g. https://github.com/tmetsch/python-dtrace)
without requiring a copy of the source tree.
For python-dtrace I worked around this in 58019c9a12
but being able to build the library without installed sources would be
extremely useful.

Reviewed By:	gnn
Differential Revision: https://reviews.freebsd.org/D27884
2021-01-07 09:26:21 +00:00
Andriy Gapon b946eede04 dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T
Note that the public documentation on dtrace.org fails to mention %T and
incorrectly documents %Y.  The latter actually uses format "%Y %b %e %T"
where %b is always in C locale.

Discussed with:	markj
MFC after:	1 month
Sponsored by:	Panzura
2020-12-03 11:59:40 +00:00
Jonathan T. Looney 96fbe51956 When copying types from one CTF container to another, ensure that we
encode 0-length (i.e. "") structure and union member names as offset 0.
This ensures that we don't confuse other parts of the CTF code which
expect this encoding.

This resolves a Dtrace error resolving members of anonymous structs/unions
within the (struct mbuf) type which some users were seeing after r366908.

While here, update the code in ctf_add_generic() to encode 0-length type
names as offset 0.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27246
2020-11-20 17:26:02 +00:00
Jonathan T. Looney 3cbb4cc200 When copying types from one CTF container to another, ensure that we
always copy intrinsic data types before copying bitfields which are
based on those types. This ensures the type ordering in the destination
CTF container matches the assumption made elsewhere in the CTF code
that instrinsic data types will always appear before bitfields based on
those types.

This resolves the following error message some users have seen after
r366908:
    "/usr/lib/dtrace/ipfw.d", line 121: failed to copy type of 'ip6p':
    Conflicting type is already defined

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27213
2020-11-17 14:07:27 +00:00
Brooks Davis 73734d6eb1 Add missing includes of src.opts.mk
Without this "SUBDIR.${MK_TESTS}=tests" would always expand to
"SUBDIR.=tests" resulting in the tests not being built.

Sponsored by:	DARPA
2020-11-16 17:20:35 +00:00
Kyle Evans 7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Toomas Soome e307eb94ae loader: zfs should support bootonce an nextboot
bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25512
2020-09-21 09:01:10 +00:00
Mark Johnston c6989859ae Address compiler warnings in C code used by the DTrace test suite.
Reported by:	Jenkins
MFC after:	1 week
2020-09-19 16:15:22 +00:00
Alex Richardson 79e02149fc Fix dtrace tools bootstrap on non-FreeBSD after OpenZFS import
This required surprisingly few build system changes and only two changes to the
openZFS compat headers which have been upstreamed as
https://github.com/openzfs/zfs/pull/10863

Reviewed By:	#zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26193
2020-09-19 12:08:16 +00:00
Matt Macy 2c48331d28 MFV 2.0-rc2
- Fixes divide by zero for unusual hz
- remove cryptodev dependency
2020-09-18 23:21:24 +00:00
Andrew Turner 2a6803de1c Use MACHINE_CPUARCH when checking for arm64
Use MACHINE_CPUARCH with arm64 (aarch64) when we build code that could run
on any 64-bit Arm instruction set. This will simplify checks in downstream
consumers targeting prototype instruction sets.

The only place we check for MACHINE_ARCH == aarch64 is when building the
device tree blobs. As these are targeting current generation ISAs.

Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D26370
2020-09-14 16:12:28 +00:00
Alex Richardson e17ebfd3b7 Remove -I flag for include path that doesn't exist
Found this while trying to get macOS bootstrap to work again after OpenZFS merge.

Reviewed By:	#zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26192
2020-09-10 15:37:07 +00:00
Ryan Moeller 3fcf9dc4b7 Use MLINKS where appropriate for zfs/zpool subcommand pages
Reported by:	Julian H. Stacey
Sponsored by:	iXsystems, Inc.
2020-09-02 15:20:10 +00:00
Ryan Moeller 0667273959 Ensure zstreamdump subdir can be visited
Reported by:	Thomas Laus
Sponsored by:	iXsystems, Inc.
2020-09-01 19:02:07 +00:00
Mark Johnston 8d4b1e3b76 Correct the D definition for EINTEGRITY.
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-09-01 15:15:22 +00:00
Ryan Moeller 40d0fd2875 libzfs: Add missing crypto dependency
libzfs_crypto.c uses PKCS5_PBKDF2_HMAC_SHA1 from libcrypto.

Reported by:	John Kennedy
Sponsored by:	iXsystems, Inc.
2020-08-27 13:05:41 +00:00
Ryan Moeller 507cf10ad5 Move zstd sources from libzfs to libzpool
zstd is kernel code that was not supposed to be in libzfs.

libzpool provides userland shims for kernel code and is where the
zstd code needs to be included.

Reported by:	John Kennedy
Discussed with:	mmacy
Sponsored by:	iXsystems, Inc.
2020-08-26 19:03:15 +00:00
Ryan Moeller 67c97ec2d6 Tidy up libzpool Makefile
Sponsored by:	iXsystems, Inc.
2020-08-26 19:00:17 +00:00
Ryan Moeller ec45a4d383 Install zfs-events.5
Sponsored by:	iXsystems, Inc.
2020-08-26 15:43:44 +00:00
Brandon Bergren 89509c956c [PowerPC] Apply the ppc32 GOT overflow fix to powerpcspe
powerpcspe is also a 32 bit ppc platform, and also needs to be -fPIC to
avoid overflowing the GOT.

Sponsored by:	Tag1 Consulting, Inc.
2020-08-25 18:54:10 +00:00
Matt Macy b3fc6d6612 Fix libzfs build failures for some
In some environments adding zstd/include to the include path
would cause zstd's stdlib.h to hide the system one.
2020-08-25 03:43:52 +00:00
Matt Macy 9e5787d228 Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
  project quotas, encrypted datasets,
  allocation classes, vectorized raidz,
  vectorized checksums, various command line
  improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
Mark Johnston c612709bce Fix a typo in r364438 affecting 32-bit platforms.
Reported by:	antoine
MFC with:	r364438
2020-08-22 14:24:17 +00:00
Mark Johnston e627909d04 Fix a typo in r364438.
Reported by:	Jenkins
MFC with:	r364438
2020-08-20 20:11:58 +00:00
Mark Johnston d2d16e5663 Enable creation of static userspace probes in incremental builds.
To define USDT probes, dtrace -G makes use of relocations for undefined
symbols: the target address is overwritten with NOPs and the location is
recorded in the DOF section of the output object file.  To avoid link
errors, the original relocation is destroyed.  However, this means that
the same input object file cannot be processed multiple times, as
happens during incremental rebuilds.  Instead, only set the relocation
type to NONE, so that all information required to reconstruct USDT
probes is preserved.

Reported by:	bdrewery
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
2020-08-20 19:28:19 +00:00
Mark Johnston 0e15d9fbeb Remove non-FreeBSD ifdefs from dt_link.c.
This file is too complicated as it is and has diverged a fair bit from
illumos due to toolchain differences, so just drop unused code
(including SPARC support).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-08-20 19:27:49 +00:00
Alan Somers 02fa3d2963 zfs: fix EIO accessing dataset after resuming interrupted receive
ZFS unmounts a dataset while receiving into it and remounts it afterwards.
But if ZFS is resuming an incomplete receive, it screws up and ends up with
a dataset that is mounted, but returns EIO for every access. This commit
fixes that condition.

While the vulnerable code also exists in OpenZFS, the problem is not
reproducible there. Apparently OpenZFS doesn't unmount the destination
dataset during receive, like FreeBSD does.

PR:		248606
Reviewed by:	mmacy
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D26034
2020-08-20 01:31:21 +00:00
Alex Richardson fded98749a Fix libdtrace build with zsh as /bin/sh
When zsh runs in POSIX sh mode it does not support the -e flag to echo.
Use printf instead of echo to avoid the "-e" characters being printed.

Obtained from:	CheriBSD
Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D26026
2020-08-11 16:46:54 +00:00
Alex Richardson f57b27e3f8 Fix -DBUILD_WITH_STRICT_TMPPATH dtrace builds
Some of the scripts used for libdtrace invoke nawk instead of awk
(for example cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh).
When bootstrapping all tools, we get the nawk -> awk link while building
usr.bin/awk, but when linking/copying the dependencies from the host we
were only adding awk but not nawk.

This was silently generating invalid files when building libdtrace with
BUILD_WITH_STRICT_TMPPATH=1 since those scripts invoke nawk instead of
awk. In addition to adding the missing link this commit also adds
set -e to those scripts to catch errors like this in the future.

Reviewed By:	markj, emaste
Differential Revision: https://reviews.freebsd.org/D26025
2020-08-11 16:46:48 +00:00
Alex Richardson ec4deee4e4 Fix cddl tools bootstrapping on macOS and Linux
Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25979
2020-08-07 16:03:55 +00:00
Alex Richardson 5ac01ce026 ctfmerge: Fix missing pthread_cond_init()
This does not appear to matter on FreeBSD or Linux, but when building an
amd64 kernel on macOS I was seeing infinite loops in ctfmerge.
It turns out the loop in wip_save_work() was looping forever due to
pthread_cond_wait() always returning -EINVAL.

Reviewed By:	markj, brooks
Differential Revision: https://reviews.freebsd.org/D25973
2020-08-06 20:44:40 +00:00
Toomas Soome 722c2b4aca MFOpenZFS: Add support for boot environment data to be stored in the label
We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.

Original patch description follows:

Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.

This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.

We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.

Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #10009

Obtained from:	OpenZFS
Sponsored by:	Netflix, Klara Inc.
2020-08-05 14:32:20 +00:00
Yoshihiro Takahashi 8f11c99715 - Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D25831
2020-07-28 10:58:37 +00:00
Mark Johnston 4cbba6ae24 MFOpenZFS: Fix zpool history unbounded memory usage
In original implementation, zpool history will read the whole history
before printing anything, causing memory usage goes unbounded. We fix
this by breaking it into read-print iterations.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #9516

Note, this change changes the libzfs.so ABI by modifying the prototype
of zpool_get_history().  Since libzfs is effectively private to the base
system it is anticipated that this will not be a problem.

PR:		247557
Obtained from:	OpenZFS
Reported and tested by:	Sam Vaughan <samjvaughan@gmail.com>
Discussed with:	freqlabs
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25745
openzfs/zfs@7125a109dc
2020-07-23 14:21:45 +00:00
Gordon Bergling cb65eb43ad zpool(8): Fix a few typos regarding 'inverval' -> 'interval'
PR:		248068
Submitted by:	PauAmma <pauamma at gundo dot com>
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D25719
2020-07-20 13:01:19 +00:00
Allan Jude af84ca2603 zpool-features(7): Note that the boot loader has support for large_blocks
Since r304321 (-current: Aug 18, 2016) and r328866 (stable/11: Feb 5, 2018)
the FreeBSD loader has supported reading from datasets with the
large_blocks feature active.

PR:		247992
Reported by:	Anton Saietskii <vsasjason@gmail.com>
MFC after:	2 weeks
Sponsored by:	Klara Inc.
2020-07-15 14:38:15 +00:00
Brooks Davis 2938ecc85c Fix a Wvoid-pointer-to-enum-cast warning missed in r359978.
This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless.  Silence the warning
by casting through uintptr_t.

This warning is on by default in Clang 11.

MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24425
2020-07-06 22:39:42 +00:00
Toomas Soome a14844e0d6 MFOpenZFS: Add basic zfs ioc input nvpair validation
We want newer versions of libzfs_core to run against an existing
zfs kernel module (i.e. a deferred reboot or module reload after
an update).

Programmatically document, via a zfs_ioc_key_t, the valid arguments
for the ioc commands that rely on nvpair input arguments (i.e. non
legacy commands from libzfs_core). Automatically verify the expected
pairs before dispatching a command.

This initial phase focuses on the non-legacy ioctls. A follow-on
change can address the legacy ioctl input from the zfs_cmd_t.

The zfs_ioc_key_t for zfs_keys_channel_program looks like:

static const zfs_ioc_key_t zfs_keys_channel_program[] = {
       {"program",     DATA_TYPE_STRING,               0},
       {"arg",         DATA_TYPE_UNKNOWN,              0},
       {"sync",        DATA_TYPE_BOOLEAN_VALUE,        ZK_OPTIONAL},
       {"instrlimit",  DATA_TYPE_UINT64,               ZK_OPTIONAL},
       {"memlimit",    DATA_TYPE_UINT64,               ZK_OPTIONAL},
};

Introduce four input errors to identify specific input failures
(in addition to generic argument value errors like EINVAL, ERANGE,
EBADF, and E2BIG).

ZFS_ERR_IOC_CMD_UNAVAIL the ioctl number is not supported by kernel
ZFS_ERR_IOC_ARG_UNAVAIL an input argument is not supported by kernel
ZFS_ERR_IOC_ARG_REQUIRED a required input argument is missing
ZFS_ERR_IOC_ARG_BADTYPE an input argument has an invalid type

Reviewed by:	allanjude
Obtained from:	OpenZFS
Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25393
2020-06-23 06:42:39 +00:00
Allan Jude 9598fc63e6 ZFS: Allow setting checksum=skein on boot pools
PR:		245889
Reported by:	delphij
Sponsored by:	Klara Inc.
2020-06-19 17:59:55 +00:00
Gordon Bergling 932a690c51 Add HISTORY sections to ZFS and dtrace manpage
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:		7 days
Differential Revision:	https://reviews.freebsd.org/D23833
2020-06-14 05:50:28 +00:00
Konstantin Belousov d0ca9a7fe4 Restore the binary compatibility for link_map l_addr.
Keep link_map l_addr binary layout compatible, rename l_addr to l_base
where rtld returns map base.  Provide relocbase in newly added l_addr.

This effectively reverts the patch to the initial version of D24918.

Reported by: antoine (portmgr)
Reviewed by:	jhb, markj
Tested by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24946
2020-05-21 22:24:23 +00:00
Andriy Gapon 54904c38f8 zfs allow/unallow should work with numeric uid/gid
And that should work even (especially) if there is no matching user or
group name.  This change allows to see and modify delegations for
deleted groups and users.

The change is originally by Xin Li.
illumos report: https://www.illumos.org/issues/6037
OpenZFS (ZoL) PR: https://github.com/openzfs/zfs/pull/10280

Obtained from:	delphij
MFC after:	2 weeks
2020-05-12 09:04:57 +00:00
Bryan Drewery b155807e48 dtrace tests: Support globbing for excludes
Downstream this makes skipping tests like common/ip/tst.*sctp*.ksh simpler.

Reviewed by:	vangyzen, cem, markj
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D24608
2020-04-29 21:12:32 +00:00
Bryan Drewery 75a813087a Revert r360445
I did not intend to commit this yet as more work is needed for
non-amd64 kernels.
2020-04-28 18:53:49 +00:00
Bryan Drewery 6f63e88c01 ctfmerge: Assert that there is enough room for types.
Sponsord by:		Dell EMC
Differential Revision:	https://reviews.freebsd.org/D24537
2020-04-28 16:09:28 +00:00
Alan Somers 420a5a2445 zfs-program.8: fix orphan .Xr
Reported by:	phk
Reviewed by:	avg
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24488
2020-04-18 20:55:43 +00:00
Alan Somers 35f139130a zfsd.8: fix orphan .Xr
Though ZFS is a kernel module, it has no man page in section 4.

Reported by:	phk
MFC after:	2 weeks
2020-04-18 19:47:38 +00:00
Mariusz Zaborski 23ee238fe5 zfs: Add option for forcible unmounting dataset while receiving snapshot.
Currently when the dataset is in use we can't receive snapshots.

zfs send test/1@asd | zfs recv -FM test/2
cannot unmount '/test/2': Device busy

This commits add option 'M' which attempts to forcibly unmount the
dataset.  Thanks to this we can enforce receiving snapshots in a
single step.

Note that this functionality is not supported on Linux because the
VFS will prevent active mounted filesystems from being unmounted,
even with the force option.  This is the intended VFS behavior.

Discussed-with: Pawel Jakub Dawidek <pjd@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allanjude@freebsd.org>
Differential Revision:	https://reviews.freebsd.org/D22306

openzfs/zfs@a57d3d45d6
2020-04-11 17:54:35 +00:00
Kyle Evans cddf6d61d1 zfs: fix -fno-common issues
A similar (or identical?) fix has already landed in OpenZFS.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-03-28 17:00:38 +00:00
Ryan Moeller 69534635ff MFOpenZFS: ZVOLs should not be allowed to have children
zfs create, receive and rename can bypass this hierarchy rule. Update
both userland and kernel module to prevent this issue and use pyzfs
unit tests to exercise the ioctls directly.

Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
differentiate a generic error (EINVAL) from the specific case where we
tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>

Approved by:	mav (mentor)
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
openzfs/zfs@d8d418ff0c
2020-03-25 15:56:18 +00:00
Alexander Motin d3c6ba3214 MFOpenZFS: make zil max block size tunable
We've observed that on some highly fragmented pools, most metaslab
allocations are small (~2-8KB), but there are some large, 128K
allocations.  The large allocations are for ZIL blocks.  If there is a
lot of fragmentation, the large allocations can be hard to satisfy.

The most common impact of this is that we need to check (and thus load)
lots of metaslabs from the ZIL allocation code path, causing sync writes
to wait for metaslabs to load, which can take a second or more.  In the
worst case, we may not be able to satisfy the allocation, in which case
the ZIL will resort to txg_wait_synced() to ensure the change is on
disk.

To provide a workaround for this, this change adds a tunable that can
reduce the size of ZIL blocks.

External-issue: DLPX-61719
Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #8865
openzfs/zfs@b8738257c2

MFC after:	2 weeks
2020-03-19 01:05:54 +00:00
Mark Johnston d8f743dcaa Do not load dtraceall.ko if dtrace.ko is already loaded.
This was the intent of the existing code, but instead it would
unconditionally load dtraceall.ko because of a stale errno value.

Reported by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-02-28 17:05:27 +00:00
Michael Tuexen a357466592 sack_newdata and snd_recover hold the same value. Therefore, use only
a single instance: use snd_recover also where sack_newdata was used.

Submitted by:		Richard Scheffenegger
Differential Revision:	https://reviews.freebsd.org/D18811
2020-02-13 15:14:46 +00:00
Brandon Bergren 7283901ae9 [PowerPC] [DTrace] Add ELFv2 support in libdtrace
PPC64 ELFv2 acts like a "normal" platform in that it no longer needs
function descriptors. So, ensure we are only enabling them on ELFv1.

Additionally, ELFv2 requires that the ELF header have a nonzero e_flags,
so ensure that the synthesized ELF header in dt_link.c is setting it.

Reviewed by:	jhibbits, markj
Approved by:	gnn
Differential Revision:	https://reviews.freebsd.org/D22403
2020-02-05 19:39:48 +00:00
Alan Somers 03e7a2be06 Speed up "zpool import" in the presence of many zvols
By default, zpools may not be backed by zvols (that can be changed with the
"vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel
does not attempt to read zvols when looking for vdevs. But the zpool command
still does. This change brings the zpool command into line with the kernel's
behavior. It speeds "zpool import" when an already imported pool has many
zvols, or a zvol with many snapshots.

PR:		241083
Reported by:	Martin Birgmeier <d8zNeCFG@aon.at>
Reviewed by:	mav, Ryan Moeller <ryan@freqlabs.com>
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D22077
2020-01-28 23:07:31 +00:00
Kyle Evans 149d640cfa libzfs: add zfs_mount_at
This will be used in libbe in place of the internal zmount(); libbe only
wants to be able to mount a dataset at an arbitrary mountpoint without
altering dataset/pool properties. The natural way to do this in a portable
way is by creating a zfs_mount_at() interface that's effectively zfs_mount()
+ a mountpoint parameter. zfs_mount() is now a light wrapper around the new
method.

The interface and implementation have already been accepted into ZFS On
Linux, and the next commit to switch libbe() over to this new interface will
solve the last compatibility issue with ZoL.  The next sysutils/openzfs
rebase against ZoL should be able to build libbe/bectl with only minor
adjustments to build glue.

Reviewed by:	Ryan Moeller <ryan freqlabs com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23132
2020-01-19 02:45:02 +00:00
Mark Johnston 938acb0869 Use a deterministic hash for USDT symbol names.
Previously libdtrace used ftok(3), which hashes the inode number of the
input object file.  To increase reproducibility of builds that embed
USDT probes, include a hash of the object file path in the symbol name
instead.

Reported and tested by:	bdrewery
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2020-01-07 21:56:20 +00:00
Mateusz Guzik 04d88d154d vfs: add a file missed in r356337 2020-01-03 22:47:31 +00:00
Mark Johnston a2ea78495a Add libdtrace support for arm64 USDT probes.
arm64 is still lacking a fasttrap implementation, which is required to
actually enable userland probes, but this at least allows USDT probes to
be linked into userland applications.

Submitted by:	Klaus Küchemann <maciphone2@googlemail.com> (original)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22360
2019-12-29 21:46:50 +00:00
Ryan Libby fa19b250bd dtrace: avoid gcc9 Walloca-larger-than
gcc9 grew a new warning for unbounded allocas, such as the one in
dt_options_load.  Remove both uses of alloca in dt_options.c.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22880
2019-12-21 02:44:13 +00:00
Simon J. Gerraty 2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Toomas Soome b0ad855d40 libzpool: use CFLAGS.lz4.c to build lz4.o and lz4.pico
Clean up this Makefile a bit.
2019-12-02 15:37:06 +00:00
Andriy Gapon 8491540808 MFV r354383: 10592 misc. metaslab and vdev related ZoL bug fixes
illumos/illumos-gate@555d674d5d
555d674d5d

https://www.illumos.org/issues/10592
  This is a collection of recent fixes from ZoL:
  8eef997679 Error path in metaslab_load_impl() forgets to drop ms_sync_lock
  928e8ad47d Introduce auxiliary metaslab histograms
  425d3237ee Get rid of space_map_update() for ms_synced_length
  6c926f426a Simplify log vdev removal code
  21e7cf5da8 zdb -L should skip leak detection altogether
  df72b8bebe Rename range_tree_verify to range_tree_verify_not_present
  75058f3303 Remove unused vdev_t fields

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>
MFC after:	4 weeks
2019-11-21 13:35:43 +00:00
Andriy Gapon 489912da7b MFV r354382,r354385: 10601 10757 Pool allocation classes
illumos/illumos-gate@663207adb1
663207adb1

10601 Pool allocation classes
https://www.illumos.org/issues/10601
  illumos port of ZoL Pool allocation classes. Includes at least these two
  commits:
  441709695 Pool allocation classes misplacing small file blocks
  cc99f275a Pool allocation classes

10757 Add -gLp to zpool subcommands for alt vdev names
https://www.illumos.org/issues/10757
  Port from ZoL of
  d2f3e292d Add -gLp to zpool subcommands for alt vdev names
  Note that a subsequent ZoL commit changed -p to -P
  a77f29f93 Change full path subcommand flag from -p to -P

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Portions contributed by: Håkan Johansson <f96hajo@chalmers.se>
Portions contributed by: Richard Yao <ryao@gentoo.org>
Portions contributed by: Chunwei Chen <david.chen@nutanix.com>
Portions contributed by: loli10K <ezomori.nozomu@gmail.com>
Author: Don Brady <don.brady@delphix.com>

11541 allocation_classes feature must be enabled to add log device

illumos/illumos-gate@c1064fd7ce
c1064fd7ce

https://www.illumos.org/issues/11541
  After the allocation_classes feature was integrated, one can no longer add a
  log device to a pool unless that feature is enabled. There is an explicit check
  for this, but it is unnecessary in the case of log devices, so we should handle
  this better instead of forcing the feature to be enabled.

Author: Jerry Jelinek <jerry.jelinek@joyent.com>

FreeBSD notes.
I faithfully added the new -g, -L, -P flags, but only -g does something:
vdev GUIDs are displayed instead of device names.  -L, resolve symlinks,
and -P, display full disk paths, do nothing at the moment.
The use of special vdevs is backward compatible for read-only access, so
root pools should be bootable, but exercise caution.

MFC after:	4 weeks
2019-11-21 08:20:05 +00:00
Andriy Gapon a4619d8461 zpool.8: remove a paragraph about quorum disks
FreeBSD has no such thing.
illumos and ZoL manuals do not talk about quorum disks either.
Only Oracle ZFS mentions them.

MFC after:	1 week
2019-11-20 08:56:01 +00:00
Andriy Gapon 54d1762459 fix up r354804, resolve merge conflicts in zpool.8
Somehow I managed to commit the manual page with unresolved conflicts in
it.

While here, I also replaced .sp with .Pp.

MFC after:	3 weeks
X-MFC with:	r354804
2019-11-20 08:49:13 +00:00
Mark Johnston 066d9631cb Fix inconsistencies in anonymous DOF files.
The DOF file output by dtrace -A contains only the loadable sections.
However, as it was created by a call to dtrace_dof_create() without
flags, the original DOF was created with the loadable sections.  The
result is that the DOF includes the section headers for the unloadable
sections (COMMENTS and UTSNAME) without these sections actually being
present.  This is inconsistent.

A simple change to anon_prog() ensures that the missing sections are
present in the outputted DOF.  Alternatively, the call to
dtrace_dof_create() could pass the DTRACE_D_STRIP flag stripping out the
loadable sections.  As the unloadable sections contain info useful for
debugging purposes they haven't been stripped.

Submitted by:	Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk>
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21875
2019-11-18 18:34:23 +00:00
Andriy Gapon 2d54db4cc9 fix up r354804, link zstreamdump with libzfs
Since r354804 libzpool depends on libzfs for get_system_hostid symbol.
Except for zstreamdump, all binaries linked with libzpool were already
linked with libzfs.  So, zstreamdump is the only fall-out.

It's interesting that on amd64 not only I was able to successfully build
zstreamdump, I am able to run it despite having the unresolved symbol in
libzpool.

MFC after:	4 weeks
X-MFC with:	r354804
2019-11-18 10:34:27 +00:00
Andriy Gapon a8c08e008a MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP)
10499 Multi-modifier protection (MMP)
illumos/illumos-gate@e0f1c0afa4
e0f1c0afa4
https://www.illumos.org/issues/10499
  Port the following ZFS commits from ZoL to illumos.
  379ca9cf2 Multi-modifier protection (MMP)
  bbffb59ef Fix multihost stale cache file import
  0d398b256 Do not initiate MMP writes while pool is suspended

10701 Correct lock ASSERTs in vdev_label_read/write
illumos/illumos-gate@58447f688d
58447f688d
https://www.illumos.org/issues/10701
  Port of ZoL commit:
  0091d66f4e Correct lock ASSERTs in vdev_label_read/write
  At a minimum, this fixes a blown assert during an MMP test run when running on
  a DEBUG build.

11770 additional mmp fixes
illumos/illumos-gate@4348eb9012
4348eb9012
https://www.illumos.org/issues/11770
  Port a few additional MMP fixes from ZoL that came in after our
  initial MMP port.
  4ca457b065 ZTS: Fix mmp_interval failure
  ca95f70dff zpool import progress kstat
  (only minimal changes from above can be pulled in right now)
  060f0226e6 MMP interval and fail_intervals in uberblock

Note from the committer (me).
I do not have any use for this feature and I have not tested it.  I only
did smoke testing with multihost=off.
Please be aware.
I merged the code only to make future merges easier.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Portions contributed by: Tim Chase <tim@chase2k.com>
Portions contributed by: sanjeevbagewadi <sanjeev.bagewadi@gmail.com>
Portions contributed by: John L. Hammond <john.hammond@intel.com>
Portions contributed by: Giuseppe Di Natale <dinatale2@llnl.gov>
Portions contributed by: Prakash Surya <surya1@llnl.gov>
Portions contributed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Olaf Faaland <faaland1@llnl.gov>

MFC after:	4 weeks
2019-11-18 09:38:35 +00:00
Andriy Gapon ee4cf489ac fix zpool list property names
This change is based on
r354380 8899 zpool list property documentation doesn't match actual behaviour

There is no "used" pool property, "alloc" is actually spelled
"allocated".

MFC after:	5 days
2019-11-07 11:50:53 +00:00
Andriy Gapon 930db3e338 MFV r354377: 10554 Implemented zpool sync command
illumos/illumos-gate@9c2acf00e2
9c2acf00e2

https://www.illumos.org/issues/10554
  During the port of MMP (illumos bug 10499) from ZoL, I found this
  earlier ZoL project is a prerequisite. Here is the original
  description.  This addition will enable us to sync an open TXG to the
  main pool on demand. The functionality is similar to 'sync(2)' but
  'zpool sync' will return when data has hit the main storage instead of
  potentially just the ZIL as is the case with the 'sync(2)' cmd.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>
MFC after:	3 weeks
Relnotes:	possibly
2019-11-07 11:18:28 +00:00