]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agozfs: merge openzfs/zfs@8ae86e2ed (master) into main
Martin Matuska [Tue, 17 Aug 2021 19:10:18 +0000 (21:10 +0200)]
zfs: merge openzfs/zfs@8ae86e2ed (master) into main

Notable upstream pull request merges:
  #12422 Fix/improve dbuf hits accounting
  #12406 Increase default volblocksize from 8KB to 16KB
  #12398 Remove b_pabd/b_rabd allocation from arc_hdr_alloc()
  #12397 Run arc_evict thread at higher priority
  #12297 Avoid vq_lock drop in vdev_queue_aggregate()
  #12161 Restore FreeBSD sysctl processing for arc.min and arc.max

Obtained from: OpenZFS
OpenZFS commit: 8ae86e2edc736483c1530fd689525aa2460eaec8

2 years ago_worldtmp: Fix some sub-makes not working with make -n
Bryan Drewery [Tue, 17 Aug 2021 19:06:14 +0000 (12:06 -0700)]
_worldtmp: Fix some sub-makes not working with make -n

2 years agocxgbei: Restrict received PDUs to 4 DDP pages in length.
John Baldwin [Tue, 17 Aug 2021 18:14:37 +0000 (11:14 -0700)]
cxgbei: Restrict received PDUs to 4 DDP pages in length.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31576

2 years agocxgbei: Only round PDU data segment lengths down by 512 on T5.
John Baldwin [Tue, 17 Aug 2021 18:14:29 +0000 (11:14 -0700)]
cxgbei: Only round PDU data segment lengths down by 512 on T5.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31575

2 years agocxgbei: Restructure how PDU limits are managed.
John Baldwin [Tue, 17 Aug 2021 18:14:11 +0000 (11:14 -0700)]
cxgbei: Restructure how PDU limits are managed.

- Compute data segment limits in read_pdu_limits() rather than PDU
  length limits.

- Add back connection-specific PDU overhead lengths to compute PDU
  length limits in icl_cxgbei_conn_handoff().

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31574

2 years agoZTS: Add tests for creation time
Ryan Moeller [Mon, 26 Jul 2021 20:08:52 +0000 (16:08 -0400)]
ZTS: Add tests for creation time

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12432

2 years agoLinux 4.11 compat: statx support
Richard Yao [Sun, 17 Mar 2019 00:43:13 +0000 (20:43 -0400)]
Linux 4.11 compat: statx support

Linux 4.11 added a new statx system call that allows us to expose crtime
as btime. We do this by caching crtime in the znode to match how atime,
ctime and mtime are cached in the inode.

statx also introduced a new way of reporting whether the immutable,
append and nodump bits have been set. It adds support for reporting
compression and encryption, but the semantics on other filesystems is
not just to report compression/encryption, but to allow it to be turned
on/off at the file level. We do not support that.

We could implement semantics where we refuse to allow user modification
of the bit, but we would need to do a dnode_hold() in zfs_znode_alloc()
to find out encryption/compression information. That would introduce
locking that will have a minor (although unmeasured) performance cost.
It also would be inferior to zdb, which reports far more detailed
information. We therefore omit reporting of encryption/compression
through statx in favor of recommending that users interested in such
information use zdb.

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Closes #8507

2 years agomount.h: improve a comment about flags
Piotr Pawel Stefaniak [Sat, 14 Aug 2021 20:07:09 +0000 (22:07 +0200)]
mount.h: improve a comment about flags

The comment only specifies MNT_ROOTFS - which is set by the kernel when
mounting its root file system. So it's not clear if any other flags
are not quite right and for what reason.

2 years agostyle.9: remove an outdated comment about indent(1)
Piotr Pawel Stefaniak [Tue, 17 Aug 2021 15:56:41 +0000 (17:56 +0200)]
style.9: remove an outdated comment about indent(1)

indent(1) has had -ncs and -nbs for some time now.

2 years agozfs.4: Fix typo s/compatiblity/compatibility/
Gordon Bergling [Tue, 17 Aug 2021 17:01:07 +0000 (19:01 +0200)]
zfs.4: Fix typo s/compatiblity/compatibility/

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Gordon Bergling <gbergling@googlemail.com>
Closes #12464

2 years agoMark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now
Alex Richardson [Tue, 17 Aug 2021 16:44:40 +0000 (17:44 +0100)]
Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now

I enabled these options again in 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3,
but unfortunately only my specific build configuration worked whereas the
build with default options is still broken.

2 years agofstyp: add BeFS support
Piotr Pawel Stefaniak [Tue, 17 Aug 2021 15:07:31 +0000 (17:07 +0200)]
fstyp: add BeFS support

A simple support for detecting BeFS (BeOS) filesystem

Submitted by: Miguel Gocobachi
Differential Revision: https://reviews.freebsd.org/D29917

2 years agoRemove b_pabd/b_rabd allocation from arc_hdr_alloc()
Alexander Motin [Tue, 17 Aug 2021 16:15:54 +0000 (12:15 -0400)]
Remove b_pabd/b_rabd allocation from arc_hdr_alloc()

When a header is allocated for full overwrite it is a waste of time
to allocate b_pabd/b_rabd for it, since arc_write() will free them
without ever being touched.  If it is a read or a partial overwrite
then arc_read() and arc_hdr_decrypt() allocate them explicitly.

Reduced memory allocation in user threads also reduces ARC eviction
throttling there, proportionally increasing it in ZIO threads, that
is not good.  To minimize or even avoid it introduce ARC allocation
reserve, allowing certain arc_get_data_abd() callers to allocate a
bit longer in situations where user threads will already throttle.

Reviewed-by: George Wilson <gwilson@delphix.com>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12398

2 years agosysctl.9: put negative sense sysctl note in own paragraph
Ed Maste [Tue, 17 Aug 2021 15:58:03 +0000 (11:58 -0400)]
sysctl.9: put negative sense sysctl note in own paragraph

The sysctl man page cautions against negative-sense boolean sysctls
(foobar_disable), but it gets lost at the end of a large paragraph.
Move it to a separate paragraph in an attempt to make it more clear.

This man page could use a more holistic review and edit pass.  This
change is simple and straightforward and I hope provides a small but
immediate benefit.

2 years agoIncrease default volblocksize from 8KB to 16KB
Alexander Motin [Tue, 17 Aug 2021 15:59:46 +0000 (11:59 -0400)]
Increase default volblocksize from 8KB to 16KB

Many things has changed since previous default was set many years ago.
Nowadays 8KB does not allow adequate compression or even decent space
efficiency on many of pools due to 4KB disk physical block rounding,
especially on RAIDZ and DRAID.  It effectively limits write throughput
to only 2-3GB/s (250-350K blocks/s) due to sync thread, allocation,
vdev queue and other block rate bottlenecks.  It keeps L2ARC expensive
despite many optimizations and dedup just unrealistic.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #12406

2 years agoOptimize arc_l2c_only lists assertions
Alexander Motin [Tue, 17 Aug 2021 15:55:34 +0000 (11:55 -0400)]
Optimize arc_l2c_only lists assertions

It is very expensive and not informative to call multilist_is_empty()
for each arc_change_state() on debug builds to check for impossible.
Instead implement special index function for arc_l2c_only->arcs_list,
multilists, panicking on any attempt to use it.

Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12421

2 years agoFix/improve dbuf hits accounting
Alexander Motin [Tue, 17 Aug 2021 15:50:31 +0000 (11:50 -0400)]
Fix/improve dbuf hits accounting

Instead of clearing stats inside arc_buf_alloc_impl() do it inside
arc_hdr_alloc() and arc_release().  It fixes statistics being wiped
every time a new dbuf is filled from the ARC.

Remove b_l1hdr.b_l2_hits. L2ARC hits are accounted at b_l2hdr.b_hits.
Since the hits are accounted under hash lock, replace atomics with
simple increments.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12422

2 years agoAvoid vq_lock drop in vdev_queue_aggregate()
Alexander Motin [Tue, 17 Aug 2021 15:47:00 +0000 (11:47 -0400)]
Avoid vq_lock drop in vdev_queue_aggregate()

vq_lock is already too congested for two more operations per I/O.
Instead of dropping and reacquiring it inside vdev_queue_aggregate()
delegate the zio_vdev_io_bypass() and zio_execute() calls for parent
I/Os to callers, that drop the lock any way to execute the new I/O.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12297

2 years agoUse more atomics in refcounts
Alexander Motin [Tue, 17 Aug 2021 15:44:34 +0000 (11:44 -0400)]
Use more atomics in refcounts

Use atomic_load_64() for zfs_refcount_count() to prevent torn reads
on 32-bit platforms.  On 64-bit ones it should not change anything.

When built with ZFS_DEBUG but running without tracking enabled use
atomics instead of mutexes same as for builds without ZFS_DEBUG.
Since rc_tracked can't change live we can check it without lock.

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

2 years agonetinet tests: delete an interface with pending lookups
Kristof Provost [Tue, 17 Aug 2021 14:19:29 +0000 (16:19 +0200)]
netinet tests: delete an interface with pending lookups

This has been known to trigger panics. It currently doesn't, but we may
as well have a test for it.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agolibfetch: use more portable getline() interface
Daniel Kolesa [Tue, 17 Aug 2021 14:01:46 +0000 (16:01 +0200)]
libfetch: use more portable getline() interface

this is for better portability in order to avoid using a function
which is BSD-only or available via libbsd

MFC after: 3 weeks

2 years agortld: constify most variables holding references to the environment values
Konstantin Belousov [Mon, 16 Aug 2021 16:55:06 +0000 (19:55 +0300)]
rtld: constify most variables holding references to the environment values

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31545

2 years agortld: provide private getenv(3)
Konstantin Belousov [Mon, 16 Aug 2021 14:02:48 +0000 (17:02 +0300)]
rtld: provide private getenv(3)

Reviewed by: arichardson, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31545

2 years agortld: avoid use of of getenv(3) for evaluating rtld env vars (LD_XXX)
Konstantin Belousov [Mon, 16 Aug 2021 12:59:05 +0000 (15:59 +0300)]
rtld: avoid use of of getenv(3) for evaluating rtld env vars (LD_XXX)

Scan through the set of environment variables during initialization and
store values in the corresponding ld_env_var_desc structure, in the
single pass at init time. This does not eliminate use of getenv(3) and
unsetenv(3) completely, but provides a foundation to do that as the next
step.

Also organize the scan in a way that makes it easier to support aliases
like LD_DEBUG vs. LD_64_DEBUG.

Suggested by: arichardson
Reviewed by: arichardson, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31545

2 years agortld: rework how environment variables are named
Konstantin Belousov [Sun, 15 Aug 2021 18:57:42 +0000 (21:57 +0300)]
rtld: rework how environment variables are named

Instead of specifying the main name part of the environment variable as the
string literal, create array of the var names and access them by symbolic
index.  Convert main name parts into complete names by prefixing with
ABI-specific ld_env_vars.

This way the name is not repeated, and also it can carry additional
proporties explicitly.  For instance, cleanup of the environment for
the setuid image does not require retyping all names.

Reviewed by: arichardson, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D31545

2 years agounbound: Vendor import 1.13.2
Cy Schubert [Tue, 17 Aug 2021 09:32:56 +0000 (02:32 -0700)]
unbound: Vendor import 1.13.2

Merge commit '625f1c1312fb7defbd148c8ba121a0cf058707ef'

MFC after: 1 month

2 years agoEnable rc.d/jail within jails
Dan Langille [Sun, 15 Aug 2021 16:53:16 +0000 (12:53 -0400)]
Enable rc.d/jail within jails

Jails with jails is a supported. This change allows the script to run
upon startup with a jail. Without this, jails are not automatically
started within jails.

2 years agoipfw: fix possible data race between jump cache reading and updating.
Andrey V. Elsukov [Tue, 17 Aug 2021 08:08:28 +0000 (11:08 +0300)]
ipfw: fix possible data race between jump cache reading and updating.

Jump cache is used to reduce the cost of rule lookup for O_SKIPTO and
O_CALLRETURN actions. It uses rules chain id to check correctness of
cached value. But due to the possible race, there is the chance that
one thread can read invalid value. In some cases this can lead to out
of bounds access and panic.

Use thread fence operations to constrain the reordering of accesses.
Also rename jump_fast and jump_linear functions to jump_cached and
jump_lookup_pos respectively.

Submitted by: Arseny Smalyuk
Reviewed by: melifaro
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D31484

2 years agosdhci_xenon: remove redundant code in property parsing
Bartlomiej Grzesik [Thu, 15 Jul 2021 15:20:46 +0000 (17:20 +0200)]
sdhci_xenon: remove redundant code in property parsing

Remove redundant ofw property parsing in driver code, is already
taken care of in mmc_fdt_helpers.

Move ofw parsing to attach method.

Reviewed by: manu
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D31409

2 years agosdhci_xenon: add AP807 compatible string
Bartlomiej Grzesik [Wed, 14 Jul 2021 12:47:40 +0000 (14:47 +0200)]
sdhci_xenon: add AP807 compatible string

This patch adds compatible string for xenon controller found on
AP807 north brige. It is fully compatible with existing driver.

Reviewed by: manu
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D31407

2 years agoipmi: New tunable to deactivate IPMI watchdog
Wojciech Macek [Tue, 17 Aug 2021 06:28:21 +0000 (08:28 +0200)]
ipmi: New tunable to deactivate IPMI watchdog

In case we want to use other WD than IPMI-provided, add
sysctl to disable initialization.

Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D31548

2 years agounbound: Vendor import 1.13.2
Cy Schubert [Mon, 16 Aug 2021 23:55:17 +0000 (16:55 -0700)]
unbound: Vendor import 1.13.2

2 years agoZTS: Avoid unset $tmpdir in redacted_panic
Ryan Moeller [Mon, 16 Aug 2021 23:38:34 +0000 (19:38 -0400)]
ZTS: Avoid unset $tmpdir in redacted_panic

The redacted_send tests make use of a $tmpdir variable, except in
redacted_send/redacted_panic the variable is never defined.

Use $TEST_BASE_DIR instead.

Clean up the stream file after the test.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12455

2 years agorouting: add IPv6 fib validation procedure.
Alexander V. Chernikov [Mon, 16 Aug 2021 23:02:29 +0000 (23:02 +0000)]
routing: add IPv6 fib validation procedure.

Allow consistency validation of the inet6 fib based on rib data.
Validation can be kicked off by loading test_lookup module and
 running sysctl net.route.test.run_inet6_scan=1

MFC after: 1 week

2 years agoevdev: Use bit_foreach helper macro
Vladimir Kondratyev [Mon, 16 Aug 2021 21:28:37 +0000 (00:28 +0300)]
evdev: Use bit_foreach helper macro

for traversing all bits set in the bitstring(9).

While here move bit_change() definition to common header.

MFC after: 1 week

2 years agoAdd gone_in(9) man page
Ed Maste [Wed, 9 Jun 2021 17:19:16 +0000 (13:19 -0400)]
Add gone_in(9) man page

Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30703

2 years agobitstring(3): Add bitstring traversal macros.
Vladimir Kondratyev [Mon, 16 Aug 2021 20:18:58 +0000 (23:18 +0300)]
bitstring(3): Add bitstring traversal macros.

The macro bit_foreach() traverses all set bits in the bitstring in the
forward direction, assigning each location in turn to variable.

The macro bit_foreach_at() traverses all set bits in the bitstring in
the forward direction at or after the zero-based bit index, assigning
each location in turn to variable.

The bit_foreach_unset() and bit_foreach_unset_at() macros which
traverses unset bits are implemented for completeness.

Reviewed by: asomers, dougm
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31469

2 years agohms(4): Allow attachment to pointer top level collection.
Vladimir Kondratyev [Mon, 16 Aug 2021 20:18:43 +0000 (23:18 +0300)]
hms(4): Allow attachment to pointer top level collection.

to be in line with Microsoft mouse driver [1]

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/top-level-collections-opened-by-windows-for-system-use

MFC after: 1 week

2 years agops4dshock(4): Fix touchpad width in HID report descriptor
Vladimir Kondratyev [Mon, 16 Aug 2021 20:18:27 +0000 (23:18 +0300)]
ps4dshock(4): Fix touchpad width in HID report descriptor

MFC after: 1 week

2 years agohid: move proper hat switch handling from ps4dshock to hgame
Greg V [Mon, 16 Aug 2021 20:18:09 +0000 (23:18 +0300)]
hid: move proper hat switch handling from ps4dshock to hgame

Generic "DirectInput" HID gamepads need this handling too.

Reviewed by: wulf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31398

2 years agohmt(4): Do not ignore constant usages in HID report descriptor parser
Jack [Mon, 16 Aug 2021 20:17:41 +0000 (23:17 +0300)]
hmt(4): Do not ignore constant usages in HID report descriptor parser

This fixes hmt to work with MELF0411 1FD2:7012 touchscreen

Obtained from: sysutils/iichid
MFC after: 1 week

2 years agohid: Add extra constant to units of measurement
Vladimir Kondratyev [Mon, 16 Aug 2021 20:13:24 +0000 (23:13 +0300)]
hid: Add extra constant to units of measurement

Some devices like eGalax touchscreens use value of 0x33 instead of 0x13
for inches as unit of measure.

Reported by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 1 week

2 years agoevdev: Do not check maximal contact number for MT initialization
Vladimir Kondratyev [Mon, 16 Aug 2021 20:12:01 +0000 (23:12 +0300)]
evdev: Do not check maximal contact number for MT initialization

This allows singletouch devices which use multitouch protocols to work.

Reported by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 1 week

2 years agohmt(4): Store Contact Count in separate variable.
Vladimir Kondratyev [Mon, 16 Aug 2021 20:11:36 +0000 (23:11 +0300)]
hmt(4): Store Contact Count in separate variable.

No functional changes.

MFC after: 1 week

2 years agosigtimedwait: Use a unique wait channel for sleeping
Mark Johnston [Mon, 16 Aug 2021 17:15:25 +0000 (13:15 -0400)]
sigtimedwait: Use a unique wait channel for sleeping

When a sigtimedwait(2) caller goes to sleep, it uses a wait channel of
p->p_sigacts with the proc lock as the interlock.  However, p_sigacts
can be shared between processes if a child is created with
rfork(RFSIGSHARE | RFPROC).  Thus we can end up with two threads
sleeping on the same wait channel using different locks, which is not
permitted.

Fix the problem simply by using a process-unique wait channel, following
the example of sigsuspend.  The actual wait channel value is irrelevant
here, sleeping threads are awoken using sleepq_abort().

Reported by: syzbot+8c417afabadb50bb8827@syzkaller.appspotmail.com
Reported by: syzbot+1d89fc2a9ef92ef64fa8@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31563

2 years agoktls: Fix accounting for TLS 1.0 empty fragments.
John Baldwin [Mon, 16 Aug 2021 17:42:46 +0000 (10:42 -0700)]
ktls: Fix accounting for TLS 1.0 empty fragments.

TLS 1.0 empty fragment mbufs have no payload and thus m_epg_npgs is
zero.  However, these mbufs need to occupy a "unit" of space for the
purposes of M_NOTREADY tracking similar to regular mbufs.  Previously
this was done for the page count returned from ktls_frame() and passed
to ktls_enqueue() as well as the page count passed to pru_ready().

However, sbready() and mb_free_notready() only use m_epg_nrdy to
determine the number of "units" of space in an M_EXT mbuf, so when a
TLS 1.0 fragment was marked ready it would mark one unit of the next
mbuf in the socket buffer as ready as well.  To fix, set m_epg_nrdy to
1 for empty fragments.  This actually simplifies the code as now only
ktls_frame() has to handle TLS 1.0 fragments explicitly and the rest
of the KTLS functions can just use m_epg_nrdy.

Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31536

2 years agoe1000: always enable PCSD when RSS hashing
Kevin Bowling [Mon, 16 Aug 2021 17:17:34 +0000 (10:17 -0700)]
e1000: always enable PCSD when RSS hashing

To enable RSS hashing in the NIC, the PCSD bit must be set.

By default, this is never set when RXCSUM is disabled - which
causes problems higher up in the stack.

While here improve the RXCSUM flag assignments when enabling or
disabling IFCAP_RXCSUM.

See also: https://lists.freebsd.org/pipermail/freebsd-current/2020-May/076148.html

Reviewed by: markj, Franco Fichtner <franco@opnsense.org>,
Stephan de Wit <stephan.dewt@yahoo.co.uk>
Obtained from: OPNsense
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31501
Co-authored-by: Stephan de Wit <stephan.dewt@yahoo.co.uk>
Co-authored-by: Franco Fichtner <franco@opnsense.org>
2 years agoipfilter: remove doubled semicolons
Ed Maste [Mon, 16 Aug 2021 17:16:23 +0000 (13:16 -0400)]
ipfilter: remove doubled semicolons

Local commit; ipfilter upstream is inactive.

Discussed with: cy
MFC after: 3 days

2 years agoApply upstream lldb fix for unhandled Error causing abort
Dimitry Andric [Mon, 16 Aug 2021 16:56:41 +0000 (18:56 +0200)]
Apply upstream lldb fix for unhandled Error causing abort

Merge commit 5033f0793fe6 from llvm git (by Dimitry Andric):

  [lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage

  When assertions are turned off, the `llvm::Error` value created at the
  start of this function is overwritten using the move-assignment
  operator, but the success value is never checked. Whenever a TypeSystem
  cannot be found or created, this can lead to lldb core dumping with:

      Program aborted due to an unhandled Error:
      Error value was Success. (Note: Success values must still be checked prior to being destroyed).

  Fix this by not creating a `llvm::Error` value in advance, and directly
  returning the result of `llvm::make_error` instead, whenever an error is
  encountered.

  See also: <https://bugs.freebsd.org/253881> and
  <https://bugs.freebsd.org/257829>.

  Reviewed By: teemperor

  Differential Revision: https://reviews.llvm.org/D108088

Reported by: dmgk, ota@j.email.ne.jp
PR: 253881, 257829
MFC after: 3 days

2 years agoRestore FreeBSD sysctl processing for arc.min and arc.max
Allan Jude [Mon, 16 Aug 2021 15:35:19 +0000 (11:35 -0400)]
Restore FreeBSD sysctl processing for arc.min and arc.max

Before OpenZFS 2.0, trying to set the FreeBSD sysctl vfs.zfs.arc_max
to a disallowed value would return an error.
Since the switch, it instead only generates WARN_IF_TUNING_IGNORED

Keep the ability to set the sysctl's specifically to 0, even though
that is less than the minimum, because some tests depend on this.

Also lost, was the ability to set vfs.zfs.arc_max to a value less
than the default vfs.zfs.arc_min at boot time. Restore this as well.

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Closes #12161

2 years agobxe: tag files to skip clang-format formatting
Ed Maste [Thu, 25 Jun 2020 00:42:10 +0000 (20:42 -0400)]
bxe: tag files to skip clang-format formatting

bxe contains three files which are sets of constants or other data, and
might be auto-generated or have an upstream.  They are rather large
files and clang-format takes quite some time when run against them, so
just skip formatting.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27806

2 years agosys/cddl: remove extraneous semicolons
Ed Maste [Mon, 16 Aug 2021 14:29:44 +0000 (10:29 -0400)]
sys/cddl: remove extraneous semicolons

Fixes: 5a1b490d502e ("FreeBSD changes to vendor source.")
Fixes: 91eaf3e1831d ("Custom DTrace kernel module...")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agopipe_paircreate(): do not leak pipepair memory on error
Konstantin Belousov [Mon, 16 Aug 2021 09:24:49 +0000 (12:24 +0300)]
pipe_paircreate(): do not leak pipepair memory on error

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agortld: Switch to the standard symbol lookup behavior if LD_DYNAMIC_WEAK is set
Fangrui Song [Sun, 15 Aug 2021 04:13:33 +0000 (07:13 +0300)]
rtld: Switch to the standard symbol lookup behavior if LD_DYNAMIC_WEAK is set

The current lookup prefers a strong definition to a STB_WEAK definition
(similar to glibc pre-2.2 behavior) which does not conform to the ELF
specification.

The non-compliant behavior provoked https://reviews.llvm.org/D4418
which was intended to fix -shared-libasan but introduced
new problems (and caused some sanitizer tests (e.g.
test/asan/TestCases/interception_failure_test.cpp) to fail): sanitizer
interceptors are STB_GLOBAL instead of STB_WEAK, so defining a second
STB_GLOBAL interceptor can lead to a multiple definition linker error.
For example, in a -fsanitize={address,memory,...} build, libc functions
like malloc/free/strtol/... cannot be provided by user object files.

See
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=16483939+0+archive/2014/freebsd-current/20140716.freebsd-current
for discussions.

This patch implements the ELF-compliant behavior when LD_DYNAMIC_WEAK is
set. STB_WEAK wrestling in symbol lookups in `Search the dynamic linker
itself` are untouched.

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26352

2 years agolibc tls: use TLS_DTV_OFFSET defined by rtld.h
Konstantin Belousov [Sun, 15 Aug 2021 02:14:26 +0000 (05:14 +0300)]
libc tls: use TLS_DTV_OFFSET defined by rtld.h

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31541

2 years agortld: Remove calculate_tls_end
Fangrui Song [Sat, 14 Aug 2021 17:02:09 +0000 (20:02 +0300)]
rtld: Remove calculate_tls_end

Variant I architectures use off and Variant II ones use size + off.
Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc
handles it.

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31539
Differential revision: https://reviews.freebsd.org/D31541

2 years agortld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0
Fangrui Song [Sat, 14 Aug 2021 16:56:58 +0000 (19:56 +0300)]
rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0

For a Variant II architecture, the TP offset of a TLS symbol is st_value -
tlsoffset + r_addend. tlsoffset is computed by either calculate_tls_offset
or calculate_first_tls_offset.

The return value of calculate_first_tls_offset is the smallest integer
satisfying res >= size and (-res) % p_align = p_vaddr % p_align
(= p_offset % p_align).  (The formula is a bit contrived. The basic idea
is to subtract the minimum integer from size + align - 1 so that the result
ihas the expected remainder.)

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31538
Differential revision: https://reviews.freebsd.org/D31541

2 years agoAdd missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap
Alex Richardson [Mon, 16 Aug 2021 08:56:17 +0000 (09:56 +0100)]
Add missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap

This causes build failures on macOS where the build can end up invoking
an incompatible m4 binary.

Fxies: 2de949cf85d0 ("Remove mkcsmapper_static and mkesdb_static from build-tools")

2 years agodomain: make it safer to add domains post-domainfinalize
Kyle Evans [Fri, 26 Jun 2020 02:38:27 +0000 (21:38 -0500)]
domain: make it safer to add domains post-domainfinalize

I can see two concerns for adding domains after domainfinalize:

1.) The slow/fast callouts have already been setup.
2.) Userland could create a socket while we're in the middle of
  initialization.

We can address #1 fairly easily by tracking whether the domain's been
initialized for at least the default vnet. There are still some concerns
about the callbacks being invoked while a vnet is in the process of
being created/destroyed, but this is a pre-existing issue that the
callbacks must coordinate anyways.

We should also address #2, but technically this has been an issue
anyways because we don't assert on post-domainfinalize additions; we
don't seem to hit it in practice.

Future work can fix that up to make sure we don't find partially
constructed domains, but care must be taken to make sure that at least,
e.g., the usages of pffindproto in ip_input.c can still find them.

Differential Revision: https://reviews.freebsd.org/D25459

2 years agohvsock: fail the probe on non-HyperV machines
Kyle Evans [Wed, 4 Aug 2021 20:57:55 +0000 (15:57 -0500)]
hvsock: fail the probe on non-HyperV machines

Differential Revision: https://reviews.freebsd.org/D25459

2 years agodomain: give domains a chance to probe for availability
Kyle Evans [Fri, 26 Jun 2020 02:17:47 +0000 (21:17 -0500)]
domain: give domains a chance to probe for availability

This gives any given domain a chance to indicate that it's not actually
supported on the current system. If dom_probe isn't supplied, we assume
the domain is universally applicable as most of them are. Keeping
fully-initialized and registered domains around that physically can't
work on a large majority of FreeBSD deployments is sub-optimal and leads
to errors that aren't consistent with the reality of why the socket
can't be created (e.g. ESOCKTNOSUPPORT) because such scenario has to be
caught upon pru_attach, at which point kicking back the more-appropriate
EAFNOSUPPORT would seem weird.

The initial consumer of this will be hvsock, which is only available on
HyperV guests.

Reviewed by: cem (earlier version), bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D25062

2 years agotpm_tis: Improve interrupt allocation
Kornel Duleba [Mon, 16 Aug 2021 04:26:50 +0000 (06:26 +0200)]
tpm_tis: Improve interrupt allocation

Validate the irq received from ACPI. Test if it works by sending a simple command and checking if the interrupt handler was executed.
Internal buffer allocation was moved away from common code to tis and crb parts - in order to test the interrupt we need to have it allocated early.

Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D31395

2 years agorouting: Use process fib instead of fib 0 when conducting tests.
Alexander V. Chernikov [Sun, 15 Aug 2021 22:05:41 +0000 (22:05 +0000)]
routing: Use process fib instead of fib 0 when conducting tests.

* Allow to do validation/performance tests by using process
 fib instead of default fib 0.
* Print all validation errors instead of just the first one.

MFC after: 1 week

2 years agofrag6: do less work in frag6_slowtimo if possible
Mateusz Guzik [Fri, 13 Aug 2021 11:32:03 +0000 (13:32 +0200)]
frag6: do less work in frag6_slowtimo if possible

frag6_slowtimo avoidably uses CPU on otherwise idle boxes

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31528

2 years agofrag6: drop the volatile keyword from frag6_nfrags and mark with __exclusive_cache_line
Mateusz Guzik [Fri, 13 Aug 2021 11:28:39 +0000 (13:28 +0200)]
frag6: drop the volatile keyword from frag6_nfrags and mark with __exclusive_cache_line

The keyword adds nothing as all operations on the var are performed
through atomic_*

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31528

2 years agoip_reass: do less work in ipreass_slowtimo if possible
Mateusz Guzik [Fri, 13 Aug 2021 09:32:16 +0000 (11:32 +0200)]
ip_reass: do less work in ipreass_slowtimo if possible

ipreass_slowtimo avoidably uses CPU on otherwise idle boxes

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31526

2 years agoip_reass: drop the volatile keyword from nfrags and mark with __exclusive_cache_line
Mateusz Guzik [Fri, 13 Aug 2021 09:29:57 +0000 (11:29 +0200)]
ip_reass: drop the volatile keyword from nfrags and mark with __exclusive_cache_line

The keyword adds nothing as all operations on the var are performed
through atomic_*

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31526

2 years agorpc: Make function tables const
Mark Johnston [Fri, 9 Jul 2021 14:56:13 +0000 (10:56 -0400)]
rpc: Make function tables const

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agotail: Add regression tests for -f and -F
Mark Johnston [Mon, 5 Jul 2021 15:01:41 +0000 (11:01 -0400)]
tail: Add regression tests for -f and -F

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31055

2 years agotail: Fix -f with stdin
Mark Johnston [Thu, 8 Jul 2021 21:40:59 +0000 (17:40 -0400)]
tail: Fix -f with stdin

Based on a patch from swills@.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31113

2 years agortsold: pass sending router address to other and managed script
Franco Fitchner [Sat, 14 Aug 2021 15:10:21 +0000 (11:10 -0400)]
rtsold: pass sending router address to other and managed script

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31518

2 years agortsold: auto-probe point to point interfaces
Franco Fitchner [Sat, 14 Aug 2021 15:08:07 +0000 (11:08 -0400)]
rtsold: auto-probe point to point interfaces

rtsold works fine for point to point interfaces in manual mode but will
not auto-probe them.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31517

2 years agobhyve: Use pci(4) to access I/O port BARs
Mark Johnston [Sat, 14 Aug 2021 14:42:34 +0000 (10:42 -0400)]
bhyve: Use pci(4) to access I/O port BARs

This removes the dependency on /dev/io.

PR: 251046
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31308

2 years agopci: Add an ioctl to perform I/O to BARs
Mark Johnston [Sat, 14 Aug 2021 14:41:43 +0000 (10:41 -0400)]
pci: Add an ioctl to perform I/O to BARs

This is useful for bhyve, which otherwise has to use /dev/io to handle
accesses to I/O port BARs when PCI passthrough is in use.

Reviewed by: imp, kib
Discussed with: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31307

2 years agolibc: vDSO timekeeping: Add pvclock support
Adam Fenn [Sat, 7 Aug 2021 20:11:29 +0000 (13:11 -0700)]
libc: vDSO timekeeping: Add pvclock support

Add support for 'VDSO_TH_ALGO_X86_PVCLK'; add vDSO-based timekeeping for
devices that support the KVM/XEN paravirtual clock API.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision:  https://reviews.freebsd.org/D31418

2 years agopvclock: Add vDSO support
Adam Fenn [Sat, 7 Aug 2021 20:10:04 +0000 (13:10 -0700)]
pvclock: Add vDSO support

Add vDSO support for timekeeping devices that support the KVM/XEN
paravirtual clock API.

Also, expose, in the userspace-accessible '<machine/pvclock.h>',
definitions that will be needed by 'libc' to support
'VDSO_TH_ALGO_X86_PVCLK'.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31418

2 years agokvm_clock: KVM paravirtual clock support
Adam Fenn [Wed, 4 Aug 2021 15:42:48 +0000 (08:42 -0700)]
kvm_clock: KVM paravirtual clock support

Add support for the KVM paravirtual clock device.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D29733

2 years agopvclock: Add 'struct pvclock' API
Adam Fenn [Sat, 7 Aug 2021 20:01:46 +0000 (13:01 -0700)]
pvclock: Add 'struct pvclock' API

Consolidate more hypervisor-agnostic functionality behind a new 'struct
pvclock' API.

This should also make it easier to subsequently add hypervisor-agnostic
vDSO timekeeping support.

Also, perform some clean-up:
    - Remove 'pvclock_get_last_cycles()'; do not allow external access
      to 'pvclock_last_systime' since this is not necessary.
    - Consolidate/simplify wall and system time reading codepaths.
    - Ensure correct ordering within wall and system time reading
      codepaths via 'atomic(9)' and 'rdtsc_ordered()' rather than via
      'rmb()'.
    - Remove some extra newlines.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31418

2 years agox86: files: Make sys/x86/x86/pvclock.c optional
Adam Fenn [Wed, 4 Aug 2021 15:10:43 +0000 (08:10 -0700)]
x86: files: Make sys/x86/x86/pvclock.c optional

Make inclusion of `sys/x86/x86/pvclock.c` contingent on that of its
dependents.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31417

2 years agox86: cpufunc: Add rdtsc_ordered()
Adam Fenn [Wed, 28 Jul 2021 17:12:00 +0000 (10:12 -0700)]
x86: cpufunc: Add rdtsc_ordered()

Add a variant of 'rdtsc()' that performs the ordered version of 'rdtsc'
appropriate for the invoking x86 variant.

Also, expose the 'lfence'-ed and 'mfence'-ed 'rdtsc()' variants needed
by 'rdtsc_ordered()' for general use.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31416

2 years agox86: cpufunc: Add rdtscp_aux()
Adam Fenn [Mon, 26 Jul 2021 19:59:55 +0000 (12:59 -0700)]
x86: cpufunc: Add rdtscp_aux()

Add a variant of 'rdtscp()' that retains and returns the 'IA32_TSC_AUX'
value read by 'rdtscp'.

Sponsored By: Juniper Networks, Inc.
Sponsored By: Klara, Inc.
Reviewed by: markj, kib
Differential Revision: https://reviews.freebsd.org/D31415

2 years agomd5(1): Fix a typo in the manual page
Gordon Bergling [Sat, 14 Aug 2021 12:48:39 +0000 (14:48 +0200)]
md5(1): Fix a typo in the manual page

- s/compatibilty/compatibility/

MFC after: 5 days

2 years agoFix a typo that was introduced while fixing a typo
Gordon Bergling [Sat, 14 Aug 2021 12:30:59 +0000 (14:30 +0200)]
Fix a typo that was introduced while fixing a typo

- s/enrtry/entry/

MFC after: 5 days

2 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 14 Aug 2021 12:17:48 +0000 (14:17 +0200)]
Fix a common typo in source code comments

- s/aligment/alignment/

MFC after: 5 days

2 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 14 Aug 2021 12:08:46 +0000 (14:08 +0200)]
Fix a common typo in source code comments

- s/definitons/definitions/

MFC after: 5 days

2 years agoAdd test for fstatat(pipefd, AT_EMPTY_PATH)
Konstantin Belousov [Sat, 14 Aug 2021 10:33:18 +0000 (13:33 +0300)]
Add test for fstatat(pipefd, AT_EMPTY_PATH)

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoFix a common typo in a comment
Gordon Bergling [Sat, 14 Aug 2021 11:29:51 +0000 (13:29 +0200)]
Fix a common typo in a comment

- s/enrty/entry/

MFC after: 5 days

2 years agoFix a few typos in source code comments
Gordon Bergling [Sat, 14 Aug 2021 08:08:49 +0000 (10:08 +0200)]
Fix a few typos in source code comments

- s/procesing/processing/

MFC after: 5 days

2 years agoFix a few typos in source code comments
Gordon Bergling [Sat, 14 Aug 2021 07:39:17 +0000 (09:39 +0200)]
Fix a few typos in source code comments

- s/posbile/possible/

MFC after: 5 days

2 years agoFix a few typos in source code comments
Gordon Bergling [Sat, 14 Aug 2021 07:06:09 +0000 (09:06 +0200)]
Fix a few typos in source code comments

- s/becase/because/

MFC after: 5 days

2 years agoFix some common typos in source code comments
Gordon Bergling [Sat, 14 Aug 2021 06:55:58 +0000 (08:55 +0200)]
Fix some common typos in source code comments

- s/struture/structure/
- s/structre/structure/

MFC after: 5 days

2 years agoaio: revert the workaround for bug 251828 in the tests
Alan Somers [Fri, 13 Aug 2021 22:59:10 +0000 (16:59 -0600)]
aio: revert the workaround for bug 251828 in the tests

This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

Do not MFC to stable/12 !

PR: 251828
Reported by: markj
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D31535

2 years agofstatat(2): handle non-vnode file descriptors for AT_EMPTY_PATH
Konstantin Belousov [Fri, 13 Aug 2021 17:40:10 +0000 (20:40 +0300)]
fstatat(2): handle non-vnode file descriptors for AT_EMPTY_PATH

Set NIRES_EMPTYPATH earlies, to have use of EMPTYPATH recorded even if
we are going to return error.  When namei_setup() refused to accept dirfd,
which is not of the vnode type, and indicated by ENOTDIR error return,
fall back to kern_fstat(dirfd).

Reported by: dchagin
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31530

2 years agomgb: update Microchip URLs
Ed Maste [Fri, 13 Aug 2021 20:57:04 +0000 (16:57 -0400)]
mgb: update Microchip URLs

Sponsored by: The FreeBSD Foundation

2 years agoar: remove duplicate function declaration in header
Ed Maste [Fri, 13 Aug 2021 19:36:13 +0000 (15:36 -0400)]
ar: remove duplicate function declaration in header

Sponsored by: The FreeBSD Foundation

2 years agozfs: add missed dependency of zfs module on zlib
Ryan Moeller [Fri, 13 Aug 2021 20:42:45 +0000 (16:42 -0400)]
zfs: add missed dependency of zfs module on zlib

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Martin Matuska <mm@FreeBSD.org>
Co-authored-by: Konstantin Belousov <kib@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
External-issue: https://reviews.freebsd.org/D31207
Closes #12442

2 years agoAdd zfs.sh -r flag to reload modules
Ryan Moeller [Fri, 13 Aug 2021 20:37:46 +0000 (16:37 -0400)]
Add zfs.sh -r flag to reload modules

zfs.sh already can load and unload, so why not both?

This is convenient when developing changes to the module and you want
to rapidly make some changes, rebuild the module, reload the module,
and test the changes.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12450

2 years agoFix usage of find in tests/Makefile.am
Ryan Moeller [Fri, 13 Aug 2021 20:13:57 +0000 (16:13 -0400)]
Fix usage of find in tests/Makefile.am

The path is not optional on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12453

2 years agoar: diff reduction against ELF Tool Chain
Ed Maste [Fri, 13 Aug 2021 15:17:24 +0000 (11:17 -0400)]
ar: diff reduction against ELF Tool Chain

Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive
directly.

(This was originally committed in d20e9e02db3d but reverted due to a
regression, now fixed with an update from cy@.)

Obtained from: ELF Tool Chain
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31496

2 years agoufs rename: ensure that the result of ufs_checkpath() is stable
Konstantin Belousov [Fri, 6 Aug 2021 01:03:19 +0000 (04:03 +0300)]
ufs rename: ensure that the result of ufs_checkpath() is stable

ufs_rename() calls ufs_checkpath() to ensure that the target directory
is not a child of the source.  If not, rename would create a loop.
For instance:
source->X1->X2->target
and if source moved under target, we get corrupted filesystem.
Suppose that we initially have
source->X1 .... and X2->target
where X1 is not on path from root to X2.  Then ufs_checkpath() accepts
the inodes, but there is nothing preventing parallel rename of X2 to become
under X1, after checkpath finished.

Ensure stability of ufs_checkpath() result by taking a per-mount sx in
ufs_rename right before ufs_checkpath() and till the end.

Reviewed by: chs, mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks