Commit Graph

1463 Commits

Author SHA1 Message Date
Mark Johnston
397e83df75 dtrace tests: Regenerate makefiles after commit d0b2dbfa0e 2024-06-01 11:16:39 -04:00
Mark Johnston
cb6b5e8ab9 dtrace tests: Fix loading of the test kernel module
The old way is racy and can cause two instances, running in parallel, to
attempt to load dtrace_test, and only one will succeed.  This caused
errors when running dtrace tests in parallel.

MFC after:	1 week
2024-06-01 11:16:33 -04:00
Mark Johnston
4bddff0833 libdtrace: Work around a warning from flex
When compiling dt_lex.l, flex produces warnings of the form:

  dt_lex.l:413: warning, trailing context made variable due to preceding '|' action
  dt_lex.l:412: warning, dangerous trailing context
  dt_lex.l:412: warning, dangerous trailing context

Here, trailing context refers to the use of "$", which expands to "/\n".

The meaning behind these warnings is described in the first two
paragraphs of the flex manual's DEFICIENCIES/BUGS section:

  Some trailing context patterns cannot be properly matched and generate
  warning messages ("dangerous trailing context").  These are patterns
  where the ending of the first part of the rule matches the beginning of
  the second part, such as "zx*/xy*", where the 'x*' matches the 'x' at
  the beginning of the trailing context.  (Note that the POSIX draft
  states that the text matched by such patterns is undefined.)

  For some trailing context rules, parts which are actually fixed-length
  are not recognized as such, leading to the above mentioned performance
  loss.  In particular, parts using '|' or {n} (such as "foo{3}") are
  always considered variable-length.

Here, the warnings appear to be bogus in this case.  The lexer has no
problem matching either of the referenced patterns, e.g.,

  printf("foobar

or

  # 1 "asdfasdf

Introduce a small amount of code duplication to silence the warning.

MFC after:	2 weeks
2024-06-01 11:16:26 -04:00
Martin Matuska
aca928a50a zfs: merge openzfs/zfs@e2357561b
Notable upstream pull request merges:
 #15940 41ae864b6 Replace P2ALIGN with P2ALIGN_TYPED and delete P2ALIGN
 #16128 5137c132a zpool import output is not formated properly
 #16138 efbef9e6c FreeBSD: Add zfs_link_create() error handling
 #16146 04bae5ec9 Disable high priority ZIO threads on FreeBSD and Linux
 #16151 cc3869153 zfs_ioc_send: use a dedicated taskq thread for send
 #16151 adda768e3 spa: remove spa_taskq_dispatch_sync()
 #16151 515c4dd21 spa: flatten spa_taskq_dispatch_ent()
 #16151 0a543db37 spa_taskq_dispatch_ent: simplify arguments
 #16153 975a13259 Add support for parallel pool exports
 #16153 89acef992 Simplified the scope of the namespace lock
 #16159 136c05321 ZAP: Fix leaf references on zap_expand_leaf() errors
 #16162 af5dbed31 Fix scn_queue races on very old pools
 #16165 3400127a7 Fix ZIL clone records for legacy holes
 #16167 414acbd37 Unbreak FreeBSD cross-build on MacOS broken in 051460b8b
 #16172 eced2e2f1 libzfs: Fix mounting datasets under thread limit pressure
 #16178 b64afa41d Better control the thread pool size when mounting datasets
 #16181 fa99d9cd9 zfs_dbgmsg_print: make FreeBSD and Linux consistent
 #16191 e675852bc dbuf: separate refcount calls for dbuf and dbuf_user
 #16198 a043b60f1 Correct level handling in zstream recompress
 #16204 34906f8bb zap: reuse zap_leaf_t on dbuf reuse after shrink
 #16206 d0aa9dbcc Use memset to zero stack allocations containing unions
 #16207 8865dfbca Fix assertion in Persistent L2ARC
 #16208 08648cf0d Allow block cloning to be interrupted by a signal
 #16210 e2357561b FreeBSD: Add const qualifier to members of struct
        opensolaris_utsname
 #16214 800d59d57 Some improvements to metaslabs eviction
 #16216 02c5aa9b0 Destroy ARC buffer in case of fill error
 #16225 01c8efdd5 Simplify issig()

Obtained from:	OpenZFS
OpenZFS commit:	e2357561b9
2024-05-31 11:26:50 +02:00
John Baldwin
766c4ad385 libzpool: Disable -Wpointer-to-int-cast warnings for GCC
This warning is already disabled for zfs.ko.
2024-05-07 13:54:00 -07:00
Lexi Winter
74adb39cf2 zfsbootcfg(8), zpool_influxdb(8): move to the zfs package
These tools are only useful on a system running ZFS.

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1175
2024-04-22 23:04:03 -06:00
Martin Matuska
1719886f6d zfs: merge openzfs/zfs@90ba19eb7
Notable upstream pull request merges:
 #15784 90ba19eb7b Do no use .cfi_negate_ra_state within the assembly
                   on Arm64
 #15942 b6bbaa8372 Give a better message from 'zpool get' with invalid
                   pool name
 #15943 ca678bc0bc Makefile.bsd: sort and cleanup source file list
 #15953 fa480fe5ba zinject: show more device fault fields
 #15983 30c4eba4ea Fix panics when truncating/deleting files
 #15992 99741bde59 zvol: use multiple taskq
 #16015 a100a195fa Add support for zfs mount -R <filesystem>
 #16022 5e5fd0a178 Speculative prefetch for reordered requests
 #16040 997f85b4d3 L2ARC: Relax locking during write
 #16042 b12738182c Improve dbuf_read() error reporting
 #16051 a9a4290173 xdr: header cleanup
 #16052 eeca9a91d6 Fix read errors race after block cloning
 #16057 aa5445c28b Remove db_state DB_NOFILL checks from syncing context
 #16061 76d1dde94c zinject: inject device errors into ioctls
 #16072 9e63631dea Small fix to prefetch ranges aggregation
 #16077 44f337be30 Illumos#16463 zfs_ioc_recv leaks nvlist
 #16085 4725e543be zinject: "no-op" error injection
 #16086 c6da985e28 Add the BTI elf note to the AArch64 SHA2 assembly

Obtained from:	OpenZFS
OpenZFS commit:	90ba19eb7b
2024-04-16 22:54:07 +02:00
Alan Somers
25038e8de6 zfsd: fix unit tests after 89f4f91dbf
Reported by:	markj
MFC after:	1 week
MFC with:	89f4f91dbf
Sponsored by:	Axcient
Reviewed by:	Alek Pinchuk <pinchuk.alek@gmail.com>
Differential Revision: https://reviews.freebsd.org/D44744
2024-04-12 18:34:23 -06:00
Martin Matuska
4fefe1b763 zfs: merge openzfs/zfs@8f2f6cd2a
Notable upstream pull request merges:
 #15887 -multiple Fast Dedup: Cleanup and documentation ahead of
                  integrating Fast Dedup
 #15907 5600dff0e Fixed parameter passing error when calling zfs_acl_chmod
 #15908 8f2f6cd2a ddt: reduce DDT_NAMELEN

Obtained from:	OpenZFS
OpenZFS commit:	8f2f6cd2ac
2024-03-07 10:52:19 +01:00
Alan Somers
89f4f91dbf zfsd: Use vdev prop values for fault/degrade thresholds
ZED uses vdev props for setting disk fault/degrade thresholds, this
patch enables zfsd to use the same vdev props for these same tasks.

OpenZFS on Linux is using vdev props for ZED disk fault/degrade
thresholds. Originally the thresholds supported were for io and checksum
events and recently this was updated to process slow io events as
well, see
cbe882298e

This patch enables us to use the same vdev props in zfsd as ZED uses.
After this patch is merged both OSs will use the same vdev props to set
retirement thresholds.

It's probably important to note that the threshold defaults are
different between OS. I've kept the existing defaults inside zfsd and
DID NOT match them to what ZED does.

Differential Revision: https://reviews.freebsd.org/D44043
MFC after:	2 weeks
Relnotes:	yes
Reviewed by:	asomers, allanjude
Sponsored by:	Axcient
Submitted by:	Alek Pinchuk <apinchuk@axcient.com>
2024-03-05 12:11:53 -07:00
Michael Tuexen
e00fd24262 dtrace: allow NULL interface pointer for ifinfo_t translator
This is similar to other translators and will be used in static
probes where the interface is not known.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43728
2024-02-16 12:28:48 +01:00
Ed Maste
95ca89cda1 ctfmerge: demote "No ctf sections found" to a warning
If there are no CTF sections then ctfmerge just has nothing to do; it
should not be an error.

Note that ctfmerge has an option to require CTF:
     -t      Make sure that all object files have a CTF section.

Before this change, this option explicitly exited without error if none
of the object files have CTF sections, with the comment:

    If we're verifying that C files have CTF, it's safe to
    assume that in this case, we're building only from assembly
    inputs.

PR:		276930
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43878
2024-02-14 15:53:11 -05:00
Martin Matuska
a4e5e0106a zfs: merge openzfs/zfs@229b9f4ed
Notable upstream pull request merges:
 #15769 082338875 Add 'zpool status -e' flag to see unhealthy vdevs
 #15804 a0d3fe72b libzdb: Initial breakout of libzdb
 #15847 229b9f4ed LUA: Backport CVE-2020-24370's patch

Obtained from:	OpenZFS
OpenZFS commit:	229b9f4ed0
2024-02-08 16:51:08 +01:00
Minsoo Choo
f73124b077 ctfmerge: Remove function cast of strcompare() for qsort()
Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43715
2024-02-03 14:09:52 -05:00
Mark Johnston
a61d2c7fbd dtrace tests: Diff expected and actual output upon a miscompare
This makes quick diagnosis of test failures easier.

MFC after:	1 week
2024-01-10 18:19:36 -05:00
Mark Johnston
ba10366037 dtrace tests: Catch up with ping(8) output changes
MFC after:	1 week
2024-01-10 18:19:00 -05:00
Mark Johnston
66bfb4b2ee dtrace tests: Require perl
A number of tests use it, so just require it globally as we do with
other tools.

MFC after:	1 week
2024-01-10 18:18:27 -05:00
Mark Johnston
9f5dd61e14 dtrace tests: Stop hard-coding an incorrect path to sleep(1)
MFC after:	1 week
2024-01-10 18:18:01 -05:00
Mark Johnston
e25922b34e dtrace tests: Run ksh with -p
In particular, avoid loading the user's .profile file, since that can
have undesirable side effects.  Most tests were already careful to do
this.

MFC after:	1 week
2024-01-10 18:17:59 -05:00
Domagoj Stolfa
93f27766a7 dtrace: Add the 'oformat' libdtrace option
This option can be used to specify a format to use in DTrace output.
The following formats are supported:
 - json
 - xml
 - html
 - none (default DTrace output)

This is implemented using libxo and integrated into libdtrace. Client
code only works with the following API:

 - dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting.
 - dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished
 - dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled.
 - dtrace_set_outfp(FILE *) -- sets the output file for oformat.
 - Ensure that oformat is correctly checked in the drop handler and record
   processing callbacks.

This commit also adds tests which check if the generated output is
valid (JSON, XML) and extends the dtrace(1) describing the structured output.

Reviewed by:	markj
Discussed with:	phil
MFC after:	2 months
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41745
2024-01-10 18:14:26 -05:00
Mark Johnston
78cd75393e ctfconvert: Handle DW_AT_data_bit_offset
This attribute is new in DWARF 4 and supersedes DW_AT_bit_offset.

PR:		276059
Reported by:	rscheff
Tested by:	rscheff
MFC after:	1 week
2024-01-01 23:12:29 -05:00
Mark Johnston
c3268c23de libdtrace: Fix TCP data offset handling in the tcpinfo_t translator
The header gives an offset in 32-bit words, and the translator is
supposed to convert that to a byte count.  But, the conversion was
incorrect.

Reviewed by:	tuexen, rscheff
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43264
2024-01-01 18:03:54 -05:00
Richard Scheffenegger
38c63bdc46 libdtrace: decode all tcp header flags and add
decoding capability of TH_AE to dtrace, including
the example provided with tcpdebug.

MFC after:             1 week
Reviewed By:           markj, mav
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43243
2023-12-31 15:02:03 +01:00
Mark Johnston
ad3174ecea libdtrace: Fix line number reporting in error messages
MFC after:	1 week
2023-12-31 12:47:30 -05:00
Dimitry Andric
bc6051a060 libicp(_rescue)?: use asm versions for all 32-bit arm flavors
OpenZFS upstream refactored the asm versions of sha2 to be usable on all
32-bit arm flavors, so it is not necessary to limit this to armv6 and
armv7.

Suggested by:	jhb
2023-12-13 20:00:35 +01:00
Brooks Davis
8ccd0b876e libc: expose execvpe for Linux compat
We already implemented execvpe internally with an _ prefix in libc so
go ahead and expose it for compatibility with Linux.

This reverts c605eea952.

Bump __FreeBSD_version for the addition and add definitions to supress
compat shims in libzfs (zfs changes were merged from upstream).

PR:		275370 (request and exp-run (thanks antoine!))
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42846
2023-12-11 19:24:53 +00:00
Dimitry Andric
1a4a9a5057 libicp_rescue: unbreak for armv6 after recent OpenZFS import
Similar to fb17dfa0c8, fix libicp_rescue to include asm versions of
sha2 on armv6, to unbreak the build of rescue.

Fixes:		3494f7c019
2023-12-09 12:51:50 +01:00
Dimitry Andric
fb17dfa0c8 libicp: unbreak for armv6 after recent OpenZFS import
The following upstream commit:
727497ccdf module/icp/asm-arm/sha2: enable non-SIMD asm kernels on armv5/6

does indeed enable sha2 asm for earlier arm CPUs, but since libicp's
Makefile was not updated, this leads to:

  ld: error: undefined reference due to --no-allow-shlib-undefined: zfs_sha256_block_armv7

Fix it by compiling sha256-armv7.S and sha512-armv7.S for armv6 too.

Fixes:		3494f7c019
2023-12-09 00:09:50 +01:00
Alan Somers
d565784a7e zfsd: fault disks that generate too many I/O delay events
If ZFS reports that a disk had at least 8 I/O operations over 60s that
were each delayed by at least 30s (implying a queue depth > 4 or I/O
aggregation, obviously), fault that disk.  Disks that respond this
slowly can degrade the entire system's performance.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	delphij
Differential Revision: https://reviews.freebsd.org/D42825
2023-11-29 07:51:11 -07:00
Alexander Motin
2ac9cecac6 Fix typo in previous d282baddb0, breaking DTrace. 2023-11-17 12:42:33 -05:00
Alexander Motin
d282baddb0 Add interface NVME to devstat
This allows to list only NVMe devices in systat, iostat, vmstat, etc.
Previously those were counted as OTHER.
2023-11-15 23:03:40 -05:00
Martin Matuska
e716630d4c zfs: merge openzfs/zfs@887a3c533
Notable upstream pull request merges:
 #15022 5caeef02f RAID-Z expansion feature
 #15457 887a3c533 Increase L2ARC write rate and headroom
 #15504 1c1be60fa Unbreak FreeBSD world build after 3bd4df384

Obtained from:	OpenZFS
OpenZFS commit:	887a3c533b
2023-11-09 13:19:17 +01:00
Stephen J. Kiernan
5e3190f700 dirdeps: Update Makefile.depend* files with empty contents
Some Makefile.depend* files were committed with no contents or empty
DIRDEPS list, but they should have DIRDEPS with some contents.
2023-10-29 17:01:04 -04:00
John Baldwin
f53355131f Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961
2023-10-10 10:34:43 -07:00
Martin Matuska
abcdc1b9ae zfs: merge openzfs/zfs@2e2a46e0a
Notable upstream pull request merges:
 #15243 b53077a9e Add zfs_prepare_disk script for disk firmware install
 #15298 2e2a46e0a Invoke zdb by guid to avoid import errors
 #15301 e5d70f467 ZIL: Avoid dbuf_read() in ztest_get_data()

Obtained from:	OpenZFS
OpenZFS commit:	2e2a46e0a5
2023-09-24 23:58:34 +02:00
Martin Matuska
7a0e9e3f8f zfs: update share/zfs/compatibility.d to match current ZFS code
MFC after:	3 days
2023-09-22 01:37:38 +02:00
Alan Somers
0b294a386d Fix zfsd with the device_removal pool feature.
Previously zfsd would crash in the presence of a pool with a
top-level-vdev that had previously been removed.  The crash happened
because the configuration nvlist of such a TLV contains an empty
ZPOOL_CONFIG_CHILDREN array, which led to a pop_front from an empty
list, which has undefined behavior.

The crash only happened in stable/14 and later, probably do to
differences in libcxx, but the change should be MFCed anyway.

PR:		273663
Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	mav
Differential Revision: https://reviews.freebsd.org/D41818
2023-09-12 08:46:12 -06:00
Martin Matuska
315ee00fa9 zfs: merge openzfs/zfs@804414aad
Notable upstream pull request merges:
  #15024 Add missed DMU_PROJECTUSED_OBJECT prefetch
  #15029 Do not request data L1 buffers on scan prefetch
  #15036 FreeBSD: catch up to __FreeBSD_version 1400093
  #15039 Fix raw receive with different indirect block size
  #15047 FreeBSD: Fix build on stable/13 after 1302506
  #15049 Fix the ZFS checksum error histograms with larger record sizes
  #15052 Reduce bloat in ereport.fs.zfs.checksum events
  #15056 Avoid extra snprintf() in dsl_deadlist_merge()
  #15061 Ignore pool ashift property during vdev attachment
  #15063 Don't panic if setting vdev properties is unsupported for this vdev type
  #15067 spa_min_alloc should be GCD, not min
  #15071 Add explicit prefetches to bpobj_iterate()
  #15072 Adjust prefetch parameters
  #15076 Refactor dmu_prefetch()
  #15079 set autotrim default to 'off' everywhere
  #15080 ZIL: Fix config lock deadlock
  #15088 metaslab: tuneable to better control force ganging
  #15096 Avoid waiting in dmu_sync_late_arrival()
  #15097 BRT should return EOPNOTSUPP
  #15103 Remove zl_issuer_lock from zil_suspend()
  #15107 Remove fastwrite mechanism
  #15113 libzfs: sendrecv: send_progress_thread: handle SIGINFO/SIGUSR1
  #15122 ZIL: Second attempt to reduce scope of zl_issuer_lock
  #15129 zpool_vdev_remove() should handle EALREADY error return
  #15132 ZIL: Replay blocks without next block pointer
  #15148 zfs_clone_range should return descriptive error codes
  #15153 ZIL: Avoid dbuf_read() before dmu_sync()
  #15172 copy_file_range: fix fallback when source create on same txg
  #15180 Update outdated assertion from zio_write_compress

Obtained from:	OpenZFS
OpenZFS commit:	804414aad2
2023-08-26 23:51:42 +02:00
Domagoj Stolfa
7a3af0a59b dtrace: Remove $FreeBSD$ from genmakefiles.sh.
$FreeBSD$ is gone in head, so this should be removed as well.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D41595
2023-08-25 14:55:59 -06:00
Warner Losh
fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh
42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh
b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Domagoj Stolfa
6de0222840 dtrace: Add WITH_DTRACE_ASAN
See commit 4ae6991228.  This version of
the commit avoids inadvertently changing SHLIBDIR for libdtrace.so.
2023-08-02 09:15:08 -04:00
Eric van Gyzen
1112883e19 dtrace: remove dead code for PR_REQUESTED
libproc's PR_REQUESTED is not implemented on FreeBSD.  Remove dead code
in dtrace that would handle it.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D41225
2023-08-01 12:28:50 -05:00
Eric van Gyzen
bcbce2a29b dtrace: do not overload libproc flags
dtrace stored its PR_RLC and PR_KLC flags in the proc_handle's flags,
where they collided with PATTACH_FORCE and PATTACH_RDONLY, respectively.
Thus, Psetflags(PR_KLC) effectively also set the PATTACH_RDONLY flag.

Since the flags are private to dtrace (at least on FreeBSD), store them in
dtrace's own dt_proc structure instead.

On FreeBSD, either PR_RLC or PR_KLC was always set, so remove code that
would handle the case where neither was set.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D41121
2023-08-01 12:28:50 -05:00
Eric van Gyzen
837f6ecd88 dtrace: remove illumos code from dt_proc.c
The illumos #ifdef's in this file make it harder to read and maintain.
There is little change upstream, and increasing changes for FreeBSD.
Remove the illumos code with `unifdef`.  The only manual changes here
are the #includes and #defines at the top, and removing blank lines.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D41173
2023-08-01 12:28:50 -05:00
Mark Johnston
5cdaac92e1 dtrace: Revert the addition of WITH_DTRACE_ASAN
The follow-up fix triggers a lib32 build failure, revert everything
until the problem is addressed.
2023-08-01 13:03:10 -04:00