]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agopfsync: Unconditionally push packets when requesting state updates
Thomas Kurschel [Mon, 15 Mar 2021 13:28:52 +0000 (14:28 +0100)]
pfsync: Unconditionally push packets when requesting state updates

When we request a bulk sync we need to ensure we actually send out that
request, not just buffer it until we have enough data to send a full
packet.

PR: 254236
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29271

3 years agofix panic when rescue retransmission and FIN overlap
Richard Scheffenegger [Wed, 17 Mar 2021 15:44:29 +0000 (16:44 +0100)]
fix panic when rescue retransmission and FIN overlap

PR:           254244
PR:           254309
Reviewed By:  #transport, hselasky, tuexen
MFC after:    3 days
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29315

3 years agorelease: sync 'git count' logic with newvers.sh
Glen Barber [Wed, 17 Mar 2021 14:57:32 +0000 (10:57 -0400)]
release: sync 'git count' logic with newvers.sh

Sync determining the git count with newvers.sh by adding the
--first-parent argument.  This ensures uname(1) reflects the
file name for snapshots.

Reported by: Mark Millard
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agonvme: Replace potentially long DELAY() with pause().
Alexander Motin [Wed, 17 Mar 2021 14:30:40 +0000 (10:30 -0400)]
nvme: Replace potentially long DELAY() with pause().

In some cases like broken hardware nvme(4) may wait minutes for
controller response before timeout.  Doing so in a tight spin loop
made whole system unresponsive.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29309
Sponsored by: iXsystems, Inc.

3 years agobase: remove if_wg(4) and associated utilities, manpage
Kyle Evans [Tue, 16 Mar 2021 02:38:23 +0000 (21:38 -0500)]
base: remove if_wg(4) and associated utilities, manpage

After length decisions, we've decided that the if_wg(4) driver and
related work is not yet ready to live in the tree.  This driver has
larger security implications than many, and thus will be held to
more scrutiny than other drivers.

Please also see the related message sent to the freebsd-hackers@
and freebsd-arch@ lists by Kyle Evans <kevans@FreeBSD.org> on
2021/03/16, with the subject line "Removing WireGuard Support From Base"
for additional context.

3 years agoRemove tmpfs size and properly format generated fstab for arm
Daniel Engerg [Wed, 17 Mar 2021 14:00:57 +0000 (15:00 +0100)]
Remove tmpfs size and properly format generated fstab for arm

Remove tmpfs size limitation, this breaks make installworld and installation of some packages
Format generated fstab using tabs to make it consistent and readable

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

3 years agowpa: import fix for P2P provision discovery processing vulnerability
Cy Schubert [Wed, 17 Mar 2021 00:06:17 +0000 (17:06 -0700)]
wpa: import fix for P2P provision discovery processing vulnerability

Latest version available from: https://w1.fi/security/2021-1/

Vulnerability

A vulnerability was discovered in how wpa_supplicant processes P2P
(Wi-Fi Direct) provision discovery requests. Under a corner case
condition, an invalid Provision Discovery Request frame could end up
reaching a state where the oldest peer entry needs to be removed. With
a suitably constructed invalid frame, this could result in use
(read+write) of freed memory. This can result in an attacker within
radio range of the device running P2P discovery being able to cause
unexpected behavior, including termination of the wpa_supplicant process
and potentially code execution.

Vulnerable versions/configurations

wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled

An attacker (or a system controlled by the attacker) needs to be within
radio range of the vulnerable system to send a set of suitably
constructed management frames that trigger the corner case to be reached
in the management of the P2P peer table.

Note: FreeBSD base does not enable P2P.

3 years agoImplement pci_get_relaxed_ordering_enabled() helper function.
Hans Petter Selasky [Tue, 16 Mar 2021 15:06:42 +0000 (16:06 +0100)]
Implement pci_get_relaxed_ordering_enabled() helper function.

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImplement sndstat nvlist-based enumeration ioctls.
Ka Ho Ng [Wed, 17 Mar 2021 10:51:58 +0000 (18:51 +0800)]
Implement sndstat nvlist-based enumeration ioctls.

These ioctl commands aim to provide easier ways for user space
applications to enumerate existing audio devices and the node they can
potentially use.

The exchange of device lists between user space and kernel is done on
nv(9). Some ioctl commands are added to /dev/sndstat node:
  - SNDSTAT_REFRESH_DEVS
  - SNDSTAT_GET_DEVS
  - SNDSTAT_ADD_USER_DEVS
  - SNDSTAT_FLUSH_USER_DEVS

Bump __FreeBSD_version to reflect the addition of the ioctls.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D26884

3 years agonlmrsa: Mark deprecated for 14.
John Baldwin [Tue, 16 Mar 2021 21:34:58 +0000 (14:34 -0700)]
nlmrsa: Mark deprecated for 14.

This is the only in-tree driver for the asymmetric crypto support in
OCF that is already marked deprecated for 14.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agonfs: Cleanup dead files
Peter Jeremy [Tue, 16 Mar 2021 19:16:31 +0000 (06:16 +1100)]
nfs: Cleanup dead files

These files are no longer used by the FreeBSD base system. They were being used by the amd port but that has also been deleted.

Reviewed by: rmacklem
Sponsored by: Google
Differential Revision: https://reviews.freebsd.org/D29180

3 years agostand: Load INIT_ARRAY and FINI_ARRAY sections
Mark Johnston [Tue, 16 Mar 2021 19:01:41 +0000 (15:01 -0400)]
stand: Load INIT_ARRAY and FINI_ARRAY sections

This is required for preloading modules into a KASAN-configured kernel.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agolink_elf_obj: Add a case missing from 5e6989ba4f26
Mark Johnston [Tue, 16 Mar 2021 19:01:41 +0000 (15:01 -0400)]
link_elf_obj: Add a case missing from 5e6989ba4f26

Fixes: 5e6989ba4f26
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agopkgbase: Fix building out-of-tree manual pages
Jung-uk Kim [Tue, 16 Mar 2021 18:16:10 +0000 (14:16 -0400)]
pkgbase: Fix building out-of-tree manual pages

c7e6cb9e08d6 introduced MK_MANSPLITPKG but it was not available for
building out-of-tree manual pages.  For example, x11/nvidia-driver fails
with the following error:

===> doc (all)
make[3]: "/usr/share/mk/bsd.man.mk" line 53: Malformed conditional (${MK_MANSPLITPKG} == "no")
make[3]: Fatal errors encountered -- cannot continue

Move the definition from src.opts.mk to bsd.opts.mk to make it visible.

3 years agocxgbe(4): catch up with the latest cryptocaps.
Navdeep Parhar [Mon, 15 Mar 2021 19:54:34 +0000 (12:54 -0700)]
cxgbe(4): catch up with the latest cryptocaps.

There are two crypto capabilities that the driver didn't know about.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agorelease: do not set __MAKE_CONF and SRCCONF for the chroot build
Glen Barber [Tue, 16 Mar 2021 16:01:48 +0000 (12:01 -0400)]
release: do not set __MAKE_CONF and SRCCONF for the chroot build

PR: 254319
Submitted by: truckman
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopkg: settle the uniq extension to .pkg instead of .bsd
Baptiste Daroussin [Tue, 16 Mar 2021 15:18:48 +0000 (16:18 +0100)]
pkg: settle the uniq extension to .pkg instead of .bsd

Requested by: many

3 years agobhyve: virtio shares definitions between sys/dev/virtio
Ka Ho Ng [Tue, 16 Mar 2021 11:27:38 +0000 (19:27 +0800)]
bhyve: virtio shares definitions between sys/dev/virtio

Definitions inside usr.sbin/bhyve/virtio.h are thrown away.
Definitions in sys/dev/virtio are used instead.

This reduces code duplication.

Sponsored by: The FreeBSD Foundation
Reviewed by: grehan
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29084

3 years agopf: pool/kpool conversion code
Kristof Provost [Thu, 11 Mar 2021 10:37:05 +0000 (11:37 +0100)]
pf: pool/kpool conversion code

stuct pf_pool and struct pf_kpool are different. We should not simply
bcopy() them.

Happily it turns out that their differences were all pointers, and the
userspace provided pointers were overwritten by the kernel, so this did
actually work correctly, but we should fix it anyway.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29216

3 years agoRevert "include: Remove symlink installation"
Emmanuel Vadot [Tue, 16 Mar 2021 07:40:59 +0000 (08:40 +0100)]
Revert "include: Remove symlink installation"

This reverts commit 0006530aa14b9df56f88df7d819fae89b115d865.

3 years agoRevert "include: Tag directly the last headers"
Emmanuel Vadot [Tue, 16 Mar 2021 07:40:54 +0000 (08:40 +0100)]
Revert "include: Tag directly the last headers"

This reverts commit 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4.

3 years agopkgbase: Add an src.conf option for splitting man pages
Emmanuel Vadot [Tue, 16 Mar 2021 06:11:56 +0000 (07:11 +0100)]
pkgbase: Add an src.conf option for splitting man pages

Man pages can be big in total, add an options to split man pages
in -man packages so we produce smaller packages.
This is useful for small jails or mfsroot produced of pkgbase.
The option is off by default.

Reviewed by: bapt, Mina Galić <me@igalic.co>
Differential Revision: https://reviews.freebsd.org/D29169
MFC after:      2 weeks

3 years agoConvert libs with pc files to use PCFILES
Emmanuel Vadot [Tue, 16 Mar 2021 06:13:07 +0000 (07:13 +0100)]
Convert libs with pc files to use PCFILES

Now the .pc ends up in the correct package (-dev)

Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D29172
MFC after:      2 weeks

3 years agobsd.lib.mk: Add a install target for .pc files
Emmanuel Vadot [Tue, 16 Mar 2021 06:13:03 +0000 (07:13 +0100)]
bsd.lib.mk: Add a install target for .pc files

That way the files are correctly taggued for pkgbase

Reviewed by: bapt, emaste (both earlier version)
Differential Revision: https://reviews.freebsd.org/D29171
MFC after:      2 weeks

3 years agoinclude: Tag directly the last headers
Emmanuel Vadot [Tue, 16 Mar 2021 06:13:00 +0000 (07:13 +0100)]
include: Tag directly the last headers

We cannot easily used the TAG here and we don't yet have something to install
even .h from a diretory in bsd.prog.mk

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29170
MFC after:      2 weeks

3 years agopkgbase: Remove case for runtime and jail package ucl generation
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:56 +0000 (07:12 +0100)]
pkgbase: Remove case for runtime and jail package ucl generation

They aren't needed and produce wrong package comments :
We use to have "runtime-dev package" instead of
"FreeBSD Base System (Development Files)" for example

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29168
MFC after:      2 weeks

3 years agoinclude: Remove symlink installation
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:53 +0000 (07:12 +0100)]
include: Remove symlink installation

headers could be installed as symlink to the source tree instead of copies.
Remove the possibility to do that.
This make the makefile easier to read and to maintain and also don't duplicate
code.

While here remove some directories from LSBUDIRS as we already install them using
the INCS stuff.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29167
MFC after:      2 weeks

3 years agopkgbase: Install all cam includes with INCS
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:49 +0000 (07:12 +0100)]
pkgbase: Install all cam includes with INCS

Now they are correctly taggued and put into the -dev package

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29166
MFC after:      2 weeks

3 years agopkgbase: Install all BSM includes with INCS
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:46 +0000 (07:12 +0100)]
pkgbase: Install all BSM includes with INCS

Now they are correctly taggued and put them into the libbsm package

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29165
MFC after:      2 weeks

3 years agopkgbase: Move libicp in utilities
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:40 +0000 (07:12 +0100)]
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

3 years agofactor out PT page allocation/freeing
Jason A. Harmening [Mon, 1 Mar 2021 16:42:05 +0000 (08:42 -0800)]
factor out PT page allocation/freeing

As follow-on work to e4b8deb222278b2a, move page table page
allocation and freeing into their own functions.  Use these
functions to provide separate kernel vs. user page table page
accounting, and to wrap common tasks such as management of
zero-filled page state.

Requested by: markj, kib
Reviewed by: kib
Differential Revision:  https://reviews.freebsd.org/D29151

3 years agoStop installing kernel-only crypto headers to /usr/include/crypto.
John Baldwin [Tue, 16 Mar 2021 00:00:21 +0000 (17:00 -0700)]
Stop installing kernel-only crypto headers to /usr/include/crypto.

The only user-facing header from OCF is <crypto/cryptodev.h>.

PR: 254167 (exp-run)
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoFix fib algo rebuild delay calculation.
Alexander V. Chernikov [Mon, 15 Mar 2021 21:09:07 +0000 (21:09 +0000)]
Fix fib algo rebuild delay calculation.

Submitted by: Marco Zec <zec at fer.hr>
MFC after: 3 days

3 years agoInclude ccompile.h after opt_global.h.
Alexander Motin [Mon, 15 Mar 2021 17:48:50 +0000 (13:48 -0400)]
Include ccompile.h after opt_global.h.

This restores INVARIANTS enabling ZFS_DEBUG when built as module.

Discussed with: freqlabs
MFC after: 1 week

3 years agonetmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET
Vincenzo Maffione [Mon, 15 Mar 2021 17:39:18 +0000 (17:39 +0000)]
netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET

The netmap_ioctl() function has a reference counting bug in case of
NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`,
the function does not decrease the refcount of "nmd", which is
increased by netmap_mem_find(), causing a refcount leak.

Reported by: Xiyu Yang <sherllyyang00@gmail.com>
Submitted by: Carl Smith <carl.smith@alliedtelesis.co.nz>
MFC after: 3 days
PR: 254311

3 years agopkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz
Baptiste Daroussin [Fri, 12 Mar 2021 17:36:30 +0000 (18:36 +0100)]
pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz

The package extension is going to be changed to .bsd to be among other
things resilient to the change of compression format used and reduce
the impact of all third party tool of that change.

Ensure the bootstrap knows about it

Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D29232

3 years agoxen: move x86-specific xen_vector_callback_enabled to sys/x86
Julien Grall [Mon, 15 Mar 2021 11:27:36 +0000 (12:27 +0100)]
xen: move x86-specific xen_vector_callback_enabled to sys/x86

This is x86-only and so should not be in the common area.

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger
Differential revision: https://reviews.freebsd.org/D29040

3 years agoxen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h
Julien Grall [Mon, 15 Mar 2021 11:15:47 +0000 (12:15 +0100)]
xen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h

Fix compilation since machine/xen/xen-os.h is requiring definition
existing in xen/xen-os.h.

In general machine/xen/xen-os.h should never be included

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger
Differential revision: https://reviews.freebsd.org/D29043

3 years agoif_wg: fix build with DIAGNOSTICS
Kyle Evans [Mon, 15 Mar 2021 12:31:09 +0000 (07:31 -0500)]
if_wg: fix build with DIAGNOSTICS

This file got resynced with OpenBSD to pick up fixes that had taken
place after the version initially ported to FreeBSD.  KASSERT there is
more like MPASS here.

Reported by: David Wolfskill <david@catwhisker.org>

3 years agostress2: Update expetced errno
Peter Holm [Mon, 15 Mar 2021 11:16:52 +0000 (12:16 +0100)]
stress2:  Update expetced errno

3 years agostress2: Fix usage of unitializer data
Peter Holm [Mon, 15 Mar 2021 11:00:01 +0000 (12:00 +0100)]
stress2:  Fix usage of unitializer data

3 years agoHyper-V: hn: Initialize the internal field of per packet info on tx path
Wei Hu [Mon, 15 Mar 2021 10:20:52 +0000 (10:20 +0000)]
Hyper-V: hn: Initialize the internal field of per packet info on tx path

The RSC support feature introduced a bit field "rm_internal" in
struct rndis_pktinfo with total size unchanged.

The guest does not use this field in the tx path. However we need to
initialize it to zero in case older hosts which are not aware of this
field.

Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support")
MFC after: 2 weeks
Sponsored by: Microsoft

3 years agowlandebug.8: remove Xref for missing manpages
Fernando Apesteguía [Wed, 3 Mar 2021 06:48:11 +0000 (07:48 +0100)]
wlandebug.8: remove Xref for missing manpages

Remove references for: athdebug(8), athstats(8) and wlanstats(8)

Those are tools in the tools/ directory that are not built as part of the base
system. According to the toolds/README file:

"...these tools are not meant to be built as part of the standard system..."

Even more, the tools/tools/README is not udpated and wlanstats does not even
built on current:

error: cast from 'struct sockaddr *' to 'const struct sockaddr_dl *' increases
required alignment from 1 to 2 [-Werror,-Wcast-align]

PR:  227174
Reported by: freebsd.org@alexandrews.me.uk
Reviewed by: gbe@ adrian@
Approved by: gbe@ (mentor) adrian@
Differential Revision: https://reviews.freebsd.org/D29033

3 years agoif_wg: close the sockets if wg_socket_bind() failed
Kyle Evans [Mon, 15 Mar 2021 06:23:56 +0000 (01:23 -0500)]
if_wg: close the sockets if wg_socket_bind() failed

This fixes the remaining cred leak that prevented jails from fully dying
in some error cases.

3 years agoif_wg: stop holding creds in wg_socket_init()
Kyle Evans [Mon, 15 Mar 2021 06:21:25 +0000 (01:21 -0500)]
if_wg: stop holding creds in wg_socket_init()

We're now xlocked when we create sockets, so we're now guaranteed that
the creds won't be released out from underneath us over in
wg_prison_remove().

3 years agoif_wg: fix the !INET6 support
Kyle Evans [Mon, 15 Mar 2021 05:38:22 +0000 (00:38 -0500)]
if_wg: fix the !INET6 support

INET is still required, so formally don't build it in !INET
configurations.

3 years agotests: netinet: add missing up from local change
Kyle Evans [Mon, 15 Mar 2021 05:24:54 +0000 (00:24 -0500)]
tests: netinet: add missing up from local change

3 years agoif_wg: import latest fixup work from the wireguard-freebsd project
Kyle Evans [Mon, 15 Mar 2021 02:25:40 +0000 (21:25 -0500)]
if_wg: import latest fixup work from the wireguard-freebsd project

This is the culmination of about a week of work from three developers to
fix a number of functional and security issues.  This patch consists of
work done by the following folks:

- Jason A. Donenfeld <Jason@zx2c4.com>
- Matt Dunwoodie <ncon@noconroy.net>
- Kyle Evans <kevans@FreeBSD.org>

Notable changes include:
- Packets are now correctly staged for processing once the handshake has
  completed, resulting in less packet loss in the interim.
- Various race conditions have been resolved, particularly w.r.t. socket
  and packet lifetime (panics)
- Various tests have been added to assure correct functionality and
  tooling conformance
- Many security issues have been addressed
- if_wg now maintains jail-friendly semantics: sockets are created in
  the interface's home vnet so that it can act as the sole network
  connection for a jail
- if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0
- if_wg now exports via ioctl a format that is future proof and
  complete.  It is additionally supported by the upstream
  wireguard-tools (which we plan to merge in to base soon)
- if_wg now conforms to the WireGuard protocol and is more closely
  aligned with security auditing guidelines

Note that the driver has been rebased away from using iflib.  iflib
poses a number of challenges for a cloned device trying to operate in a
vnet that are non-trivial to solve and adds complexity to the
implementation for little gain.

The crypto implementation that was previously added to the tree was a
super complex integration of what previously appeared in an old out of
tree Linux module, which has been reduced to crypto.c containing simple
boring reference implementations.  This is part of a near-to-mid term
goal to work with FreeBSD kernel crypto folks and take advantage of or
improve accelerated crypto already offered elsewhere.

There's additional test suite effort underway out-of-tree taking
advantage of the aforementioned jail-friendly semantics to test a number
of real-world topologies, based on netns.sh.

Also note that this is still a work in progress; work going further will
be much smaller in nature.

MFC after: 1 month (maybe)

3 years agoddb: enable the use of ^C and ^S/^Q
Ryan Libby [Sun, 14 Mar 2021 23:04:27 +0000 (16:04 -0700)]
ddb: enable the use of ^C and ^S/^Q

This lets one interrupt DDB's output, which is useful if paging is
disabled and the output device is slow.

This follows a previous implementation in svn r311952 / git
5fddef79998678d256ba30316353393b4d8ebb32 which was reverted because it
broke DDB type-ahead.

Now, try this again, but with a 512-byte type-ahead buffer.  While there
is buffer space, control input is handled and non-control input is
buffered.  When the buffer is exhausted, the default is to print a
warning and drop further non-control input in order to continue handling
control input.  sysctl debug.ddb.prioritize_control_input can be set to
0 to instead preserve all input but lose immediate handling of control
input.  This could for example effect pasting of a large script into the
ddb console.

Suggested by: Anton Rang <rang@acm.org>
Reviewed by: markj
Discussed with: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28676

3 years agokobj: avoid gcc -Wcast-function-type
Ryan Libby [Sun, 14 Mar 2021 23:04:27 +0000 (16:04 -0700)]
kobj: avoid gcc -Wcast-function-type

The actual type of kobjop_t is arbitrary, it is only used as a generic
function pointer type.  Declare it as void (*)(void) in order to avoid
gcc's -Wcast-function-type, which is included in -Wextra.

Reviewed by: avg, jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28769

3 years agoMerge tcsh 6.22.03-ceccc7f
Dmitry Chagin [Sun, 14 Mar 2021 16:33:13 +0000 (19:33 +0300)]
Merge tcsh 6.22.03-ceccc7f

PR: 252663
MFC after: 1 week

3 years agoImport 6.22.03-ceccc7f
Dmitry Chagin [Sun, 14 Mar 2021 16:28:29 +0000 (19:28 +0300)]
Import 6.22.03-ceccc7f

3 years agozfs: merge OpenZFS master-9305ff2ed
Martin Matuska [Sun, 14 Mar 2021 01:23:51 +0000 (02:23 +0100)]
zfs: merge OpenZFS master-9305ff2ed

Notable upstream pull request merges:
  #11153 Scalable teardown lock for FreeBSD
  #11651 Don't bomb out when using keylocation=file://
  #11667 zvol: call zil_replaying() during replay
  #11683 abd_get_offset_struct() may allocate new abd
  #11693 Intentionally allow ZFS_READONLY in zfs_write
  #11716 zpool import cachefile improvements
  #11720 FreeBSD: Clean up zfsdev_close to match Linux
  #11730 FreeBSD: bring back possibility to rewind the
         checkpoint from bootloader

Obtained from: OpenZFS
MFC after: 2 weeks

3 years agols(1): Refine the HISTORY within the manual page.
Gordon Bergling [Sat, 13 Mar 2021 18:28:26 +0000 (19:28 +0100)]
ls(1): Refine the HISTORY within the manual page.

A simple find command appeared in Version 1 AT&T UNIX and was removed in
Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later
be enhanced for the Programmer's Workbench (PWB). These changes were
later incorporated in AT&T UNIX v7.

Reviewed by: imp
MFC after: 1 week

3 years agoUpdate vendor/openzfs to master-9305ff2ed
Martin Matuska [Sat, 13 Mar 2021 17:30:04 +0000 (18:30 +0100)]
Update vendor/openzfs to master-9305ff2ed

Notable upstream pull request merges:
  #11153 Scalable teardown lock for FreeBSD
  #11651 Don't bomb out when using keylocation=file://
  #11667 zvol: call zil_replaying() during replay
  #11683 abd_get_offset_struct() may allocate new abd
  #11693 Intentionally allow ZFS_READONLY in zfs_write
  #11716 zpool import cachefile improvements
  #11720 FreeBSD: Clean up zfsdev_close to match Linux
  #11730 FreeBSD: bring back possibility to rewind the
         checkpoint from bootloader

3 years agoFix some common typos in comments
Gordon Bergling [Sat, 13 Mar 2021 17:26:15 +0000 (18:26 +0100)]
Fix some common typos in comments

- occured -> occurred
- normaly -> normally
- controling -> controlling
- fileds -> fields
- insterted -> inserted
- outputing -> outputting

MFC after: 1 week

3 years agoFix a few typos in comments
Gordon Bergling [Sat, 13 Mar 2021 15:37:28 +0000 (16:37 +0100)]
Fix a few typos in comments

- trough -> through

MFC after: 1 week

3 years agoi386: Fix a few typos
Gordon Bergling [Sat, 13 Mar 2021 15:10:01 +0000 (16:10 +0100)]
i386: Fix a few typos

- wheter -> whether
- while here, fix some whitespace issues

MFC after: 1 week

3 years agonet80211: Fix a typo in a comment
Gordon Bergling [Sat, 13 Mar 2021 14:51:30 +0000 (15:51 +0100)]
net80211: Fix a typo in a comment

- destionation -> destination
- while here, fix some whitespace issues

MFC after: 1 week

3 years agoPartially revert libcxxrt changes to avoid _Unwind_Exception change
Dimitry Andric [Sat, 13 Mar 2021 13:54:24 +0000 (14:54 +0100)]
Partially revert libcxxrt changes to avoid _Unwind_Exception change

(Note I am also applying this to main and stable/13, to restore the old
libcxxrt ABI and to avoid having to maintain a compat library.)

After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and
d2b3fadf2db5, users reported that editors/libreoffice packages from the
official package builders did not start anymore. It turns out that the
combination of these commits subtly changes the ABI, requiring all
applications that depend on internal details of struct _Unwind_Exception
(available via unwind-arm.h and unwind-itanium.h) to be recompiled.

However, the FreeBSD package builders always use -RELEASE jails, so
these still use the old declaration of struct _Unwind_Exception, which
is not entirely compatible. In particular, LibreOffice uses this struct
in its internal "uno bridge" component, where it attempts to setup its
own exception handling mechanism.

To fix this incompatibility, go back to the old declarations of struct
_Unwind_Exception, and restore the __LP64__ specific workaround we had
in place before (which was to cope with yet another, older ABI bug).

Effectively, this reverts upstream libcxxrt commits 88bdf6b290da
("Specify double-word alignment for ARM unwind") and b96169641f79
("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2
("libcxxrt: add padding in __cxa_allocate_* to fix alignment").

PR: 253840

3 years agozfs: bring back possibility to rewind the checkpoint from
Mariusz Zaborski [Sat, 13 Mar 2021 11:56:17 +0000 (12:56 +0100)]
zfs: bring back possibility to rewind the checkpoint from

Add parsing of the rewind options.

When I was upstreaming the change [1], I omitted the part where we
detect that the pool should be rewind. When the FreeBSD repo has
synced with the OpenZFS, this part of the code was removed.

[1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c
[2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a

Originally reviewed by: tsoome, allanjude
Originally reviewed by: kevans (ok from high-level overview)

Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>
PR: 254152
Reported by: Zhenlei Huang <zlei.huang at gmail.com>
Obtained from: https://github.com/openzfs/zfs/pull/11730

3 years agozfs: make seqc asserts conditional on replay
Mateusz Guzik [Sat, 13 Mar 2021 09:10:16 +0000 (10:10 +0100)]
zfs: make seqc asserts conditional on replay

Avoids tripping on asserts when doing pool recovery.

3 years ago[ath] do a cold reset if TSFOOR triggers
Adrian Chadd [Sat, 13 Mar 2021 07:30:25 +0000 (23:30 -0800)]
[ath] do a cold reset if TSFOOR triggers

TSFOOR happens if a beacon with a given TSF isn't received within the
programmed/expected TSF value, plus/minus a fudge range. (OOR == out of range.)

If this happens then it could be because the baseband/mac is stuck, or
the baseband is deaf.  So, do a cold reset and resync the beacon to
try and unstick the hardware.

It also happens when a bad AP decides to err, slew its TSF because they
themselves are resetting and they don't preserve the TSF "well."

This has fixed a bunch of weird corner cases on my 2GHz AP radio upstairs
here where it occasionally goes deaf due to how much 2GHz noise is up
here (and ANI gets a little sideways) and this unsticks the station
VAP.

For AP modes a hung baseband/mac usually ends up as a stuck beacon
and those have been addressed for a long time by just resetting the
hardware.  But similar hangs in station mode didn't have a similar
recovery mechanism.

Tested:

* AR9380, STA mode, 2GHz/5GHz
* AR9580, STA mode, 5GHz
* QCA9344 SoC w/ on-board wifi (TL-WDR4300/3600 devices); 2GHz
  STA mode

3 years ago[ath] validate ts_antenna before updating tx statistics
Adrian Chadd [Sat, 13 Mar 2021 01:29:09 +0000 (17:29 -0800)]
[ath] validate ts_antenna before updating tx statistics

Right now ts_antenna is either 0 or 1 in each supported HAL so
this is purely a sanity check.

Later on if I ever get magical free time I may add some extensions
for the NICs that can have slightly more complicated antenna switches
for transmit and I'd like this to not bust memory.

3 years agoarm64: Add support for the RK805/RK808 RTC
Peter Jeremy [Fri, 12 Mar 2021 22:06:04 +0000 (09:06 +1100)]
arm64: Add support for the RK805/RK808 RTC

Implement a driver for the RTC embedded in the RK805/RK808 power
management system used for RK3328 and RK3399 SoCs.

Based on experiments on my RK808, setting the time doesn't alter the
internal/inaccessible sub-second counter, therefore there's no point
in calling clock_schedule().

Based on an earlier revision by andrew.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D22692
Sponsored by: Google
MFC after: 1 week

3 years agocam: Run all XPT_ASYNC ccbs in a dedicated thread
Warner Losh [Fri, 12 Mar 2021 20:20:52 +0000 (13:20 -0700)]
cam: Run all XPT_ASYNC ccbs in a dedicated thread

Queue all XPT_ASYNC ccb's and run those in a new cam async thread. This thread
is allowed to sleep for things like memory. This should allow us to make all the
registration routines for cam periph drivers simpler since they can assume they
can always allocate memory. This is a separate thread so that any I/O that's
completed in xpt_done_td isn't held up.

This should fix the panics for WAITOK alloations that are elsewhere in the
storage stack that aren't so easy to convert to NOWAIT. Additional future work
will convert other allocations in the registration path to WAITOK should
detailed analysis show it to be safe.

Reviewed by: chs@, rpokala@
Differential Revision: https://reviews.freebsd.org/D29210

3 years agoccr: Disable requests on port 1 when needed to workaround a firmware bug.
John Baldwin [Fri, 12 Mar 2021 18:35:56 +0000 (10:35 -0800)]
ccr: Disable requests on port 1 when needed to workaround a firmware bug.

Completions for crypto requests on port 1 can sometimes return a stale
cookie value due to a firmware bug.  Disable requests on port 1 by
default on affected firmware.

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

3 years agoccr: Add per-port stats of queued and completed requests.
John Baldwin [Fri, 12 Mar 2021 18:35:32 +0000 (10:35 -0800)]
ccr: Add per-port stats of queued and completed requests.

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

3 years agoccr: Set the RX channel ID correctly in work requests.
John Baldwin [Fri, 12 Mar 2021 18:35:05 +0000 (10:35 -0800)]
ccr: Set the RX channel ID correctly in work requests.

These fixes are only relevant for requests on the second port.  In
some cases, the crypto completion data, completion message, and
receive descriptor could be written in the wrong order.

- Add a separate rx_channel_id that is a copy of the port's rx_c_chan
  and use it when an RX channel ID is required in crypto requests
  instead of using the tx_channel_id.

- Set the correct rx_channel_id in the CPL_RX_PHYS_ADDR used to write
  the crypto result.

- Set the FID to the first rx queue ID on the adapter rather than the
  queue ID of the first rx queue for the port.

- While here, use tx_chan to set the tx_channel_id though this is
  identical to the previous value.

Reviewed by: np
Reported by: Chelsio QA
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29175

3 years agolib/msun: Fix x86 GCC6 build after 221622ec0c8e184
Alex Richardson [Fri, 12 Mar 2021 18:44:42 +0000 (18:44 +0000)]
lib/msun: Fix x86 GCC6 build after 221622ec0c8e184

Apparently GCC only supports arithmetic expressions that use static
const variables in initializers starting with GCC8. To keep older
versions happy use a macro instead.

Fixes: 221622ec0c ("lib/msun: Avoid FE_INEXACT for x86 log2l/log10l")
Reported by: Jenkins
Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D29233

3 years agoFetch the sigfastblock value in syscalls that wait for signals
Jonathan T. Looney [Fri, 12 Mar 2021 18:14:17 +0000 (18:14 +0000)]
Fetch the sigfastblock value in syscalls that wait for signals

We have seen several cases of processes which have become "stuck" in
kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val
is set to 0x10 (one block outstanding) and the userspace copy of the
word is set to 0 (unblocked). Because the kernel's cached value
shows that signals are blocked, kern_sigsuspend() blocks almost all
signals, which means the process hangs indefinitely in sigsuspend().

It is not entirely clear what is causing this condition to occur.
However, it seems to make sense to add some protection against this
case by fetching the latest sigfastblock value from userspace for
syscalls which will sleep waiting for signals. Here, the change is
applied to kern_sigsuspend() and kern_sigtimedwait().

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29225

3 years agox86: Update some stale comments in cpu_fork() and cpu_copy_thread().
John Baldwin [Fri, 12 Mar 2021 17:48:49 +0000 (09:48 -0800)]
x86: Update some stale comments in cpu_fork() and cpu_copy_thread().

Neither of these routines allocate stacks.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29227

3 years agox86: Always use clean FPU and segment base state for new kthreads.
John Baldwin [Fri, 12 Mar 2021 17:48:36 +0000 (09:48 -0800)]
x86: Always use clean FPU and segment base state for new kthreads.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29208

3 years agoSet TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread().
John Baldwin [Fri, 12 Mar 2021 17:48:20 +0000 (09:48 -0800)]
Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread().

This permits these routines to use special logic for initializing MD
kthread state.

For the kproc case, this required moving the logic to set these flags
from kproc_create() into do_fork().

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29207

3 years agoDon't pass RFPROC to kproc_create(), it is redundant.
John Baldwin [Fri, 12 Mar 2021 17:48:10 +0000 (09:48 -0800)]
Don't pass RFPROC to kproc_create(), it is redundant.

Reviewed by: tuexen, kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29206

3 years agoRemove unused wrappers around kproc_create() and kproc_exit().
John Baldwin [Fri, 12 Mar 2021 17:47:58 +0000 (09:47 -0800)]
Remove unused wrappers around kproc_create() and kproc_exit().

Reviewed by: imp, kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29205

3 years agox86: Copy the FPU/XSAVE state from the creating thread to new threads.
John Baldwin [Fri, 12 Mar 2021 17:47:41 +0000 (09:47 -0800)]
x86: Copy the FPU/XSAVE state from the creating thread to new threads.

POSIX states that new threads created via pthread_create() should
inherit the "floating point environment" from the creating thread.

Discussed with: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29204

3 years agoamd64: Cleanups to setting TLS registers for Linux binaries.
John Baldwin [Fri, 12 Mar 2021 17:47:31 +0000 (09:47 -0800)]
amd64: Cleanups to setting TLS registers for Linux binaries.

- Use update_pcb_bases() when updating FS or GS base addresses to
  permit use of FSBASE and GSBASE in Linux processes.  This also sets
  PCB_FULL_IRET.  linux32 was setting PCB_32BIT which should be a
  no-op (exec sets it).

- Remove write-only variables to construct unused segment descriptors
  for linux32.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29026

3 years agoamd64: Only update fsbase/gsbase in pcb for curthread.
John Baldwin [Fri, 12 Mar 2021 17:45:18 +0000 (09:45 -0800)]
amd64: Only update fsbase/gsbase in pcb for curthread.

Before the pcb is copied to the new thread during cpu_fork() and
cpu_copy_thread(), the kernel re-reads the current register values in
case they are stale.  This is done by setting PCB_FULL_IRET in
pcb_flags.

This works fine for user threads, but the creation of kernel processes
and kernel threads do not follow the normal synchronization rules for
pcb_flags.  Specifically, new kernel processes are always forked from
thread0, not from curthread, so adjusting pcb_flags via a simple
instruction without the LOCK prefix can race with thread0 running on
another CPU.  Similarly, kthread_add() clones from the first thread in
the relevant kernel process, not from curthread.  In practice, Netflix
encountered a panic where the pcb_flags in the first kthread of the
KTLS process were trashed due to update_pcb_bases() in
cpu_copy_thread() running from thread0 to create one of the other KTLS
threads racing with the first KTLS kthread calling fpu_kern_thread()
on another CPU.  In the panicking case, the write to update pcb_flags
in fpu_kern_thread() was lost triggering an "Unregistered use of FPU
in kernel" panic when the first KTLS kthread later tried to use the
FPU.

Reported by: gallatin
Discussed with: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29023

3 years agotests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output
Alex Richardson [Fri, 12 Mar 2021 17:35:24 +0000 (17:35 +0000)]
tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output

This should allow the test to pass in Jenkins. Testing it locally now
reports "passed" instead of "invalid TAP data".

While touching this file also fix some shellcheck warnings that were
pointed out by my IDE.

Reviewed By: lwhsu, afedorov
Differential Revision: https://reviews.freebsd.org/D29054

3 years agoAllow using sanitizers for ssp tests with out-of-tree compiler
Alex Richardson [Fri, 12 Mar 2021 17:15:00 +0000 (17:15 +0000)]
Allow using sanitizers for ssp tests with out-of-tree compiler

With an out-of-tree Clang, we can use the -resource-dir flag when linking
to point it at the runtime libraries from the current SYSROOT.
This moves the path to the clang-internal library directory to a separate
.mk file that can be used by Makefiles that want to find the sanitizer
libraries. I intend to re-use this .mk file for my upcoming changes that
allow building the entire base system with ASAN/UBSAN/MSAN.

Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D28852

3 years agocapsicum-test: Update for O_BENEATH removal
Alex Richardson [Fri, 12 Mar 2021 17:12:10 +0000 (17:12 +0000)]
capsicum-test: Update for O_BENEATH removal

Update the tests to check O_RESOLVE_BENEATH instead.
If this looks reasonable, I'll try to upstream this change.
This keeps a compat fallback for O_BENEATH since the Linux port still
has/had O_BENEATH with "no .., no absolute paths" semantics.

Test Plan: `/usr/tests/sys/capsicum/capsicum-test -u 977` passes and
runs the O_RESOLVE_BENEATH tests.
Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29016

3 years agoSave all fpcr/fpsr bits in the AArch64 fenv_t
Alex Richardson [Fri, 12 Mar 2021 17:01:37 +0000 (17:01 +0000)]
Save all fpcr/fpsr bits in the AArch64 fenv_t

The existing code masked off all bits that it didn't know about. To be
future-proof, we should save and restore the entire fpcr/fpsr registers.
Additionally, the existing fesetenv() was incorrectly setting the rounding
mode in fpsr instead of fpcr.

This patch stores fpcr in the high 32 bits of fenv_t and fpsr in the low
bits instead of trying to interleave them in a single 32-bit field.

Technically, this is an ABI break if you re-compile parts of your code or
pass a fenv_t between DSOs that were compiled with different versions
of fenv.h. However, I believe we should fix this since the existing code
was broken and passing fenv_t across DSOs should rarely happen.

Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D29160

3 years agoImprove the wording for showing the brightness level
Brad Davis [Fri, 12 Mar 2021 16:43:33 +0000 (09:43 -0700)]
Improve the wording for showing the brightness level

Reviewed by: allanjude

3 years agorelease: Move the vagrant.vmx config out to its own file to match vbox
Brad Davis [Tue, 26 Jan 2021 17:02:57 +0000 (10:02 -0700)]
release: Move the vagrant.vmx config out to its own file to match vbox

Silly to have all these echos and makes this easier to use in other tooling.

Reviewed by: gjb (re)

3 years agoautofs: best effort to maintain mounttab and mountdtab
Robert Wing [Wed, 17 Feb 2021 07:51:38 +0000 (22:51 -0900)]
autofs: best effort to maintain mounttab and mountdtab

When an automounted filesystem is successfully unmounted, call
rpc.umntall(8) with the -k flag.

rpc.umntall(8) is used to clean up /var/db/mounttab on the client and
/var/db/mountdtab on the server. This is only useful for NFSv3.

PR:     251906
Reviewed by: trasz
Differential Revision:  https://reviews.freebsd.org/D27801

3 years agolinux(4): make getcwd(2) return ERANGE instead of ENOMEM
Edward Tomasz Napierala [Fri, 12 Mar 2021 15:31:37 +0000 (15:31 +0000)]
linux(4): make getcwd(2) return ERANGE instead of ENOMEM

For native FreeBSD binaries, the return value from __getcwd(2)
doesn't really matter, as the libc wrapper takes over and returns
the proper errno.

PR: kern/254120
Reported By: Alex S <iwtcex@gmail.com>
Reviewed By: kib
Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29217

3 years agopf: Fully remove interrupt events on vnet cleanup
Kristof Provost [Wed, 10 Mar 2021 21:56:11 +0000 (22:56 +0100)]
pf: Fully remove interrupt events on vnet cleanup

swi_remove() removes the software interrupt handler but does not remove
the associated interrupt event.
This is visible when creating and remove a vnet jail in `procstat -t
12`.

We can remove it manually with intr_event_destroy().

PR: 254171
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29211

3 years agopf: Simplify cleanup
Kristof Provost [Wed, 10 Mar 2021 14:15:16 +0000 (15:15 +0100)]
pf: Simplify cleanup

We can now counter_u64_free(NULL), so remove the checks.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29190

3 years agoDocument that uma_zfree_pcpu() allows NULL now
Kristof Provost [Thu, 11 Mar 2021 08:32:01 +0000 (09:32 +0100)]
Document that uma_zfree_pcpu() allows NULL now

While here also document that for counter_u64_free().

Reviewed by: rpokala@
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29215

3 years agouma: allow uma_zfree_pcu(..., NULL)
Kristof Provost [Wed, 10 Mar 2021 14:11:59 +0000 (15:11 +0100)]
uma: allow uma_zfree_pcu(..., NULL)

We already allow free(NULL) and uma_zfree(..., NULL). Make
uma_zfree_pcpu(..., NULL) work as well.
This also means that counter_u64_free(NULL) will work.

These make cleanup code simpler.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29189

3 years agoWhitespace cleanup
Li-Wen Hsu [Fri, 12 Mar 2021 11:57:30 +0000 (19:57 +0800)]
Whitespace cleanup

3 years agoUpdate doc links in README
Li-Wen Hsu [Fri, 12 Mar 2021 11:55:56 +0000 (19:55 +0800)]
Update doc links in README

3 years agonull_vput_pair(): release use reference on dvp earlier
Konstantin Belousov [Sun, 7 Mar 2021 21:08:38 +0000 (23:08 +0200)]
null_vput_pair(): release use reference on dvp earlier

We might own the last use reference, and then vrele() at the end would
need to take the dvp vnode lock to inactivate, which causes deadlock
with vp. We cannot vrele() dvp from start since this might unlock ldvp.

Handle it by holding the vnode and dropping use ref after lowerfs
VOP_VPUT_PAIR() ended.  This effectivaly requires unlock of the vp vnode
after VOP_VPUT_PAIR(), so the call is changed to set unlock_vp to true
unconditionally.  This opens more opportunities for vp to be reclaimed,
if lvp is still alive we reinstantiate vp with null_nodeget().

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agovlrureclaim: only skip vnode with resident pages if it own the pages
Konstantin Belousov [Sat, 6 Mar 2021 21:09:16 +0000 (23:09 +0200)]
vlrureclaim: only skip vnode with resident pages if it own the pages

Nullfs vnode which shares vm_object and pages with the lower vnode should
not be exempt from the reclaim just because lower vnode cached a lot.
Their reclamation is actually very cheap and should be preferred over
real fs vnodes, but this change is already useful.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agosoftdep_unmount: assert that no dandling dependencies are left
Konstantin Belousov [Sat, 6 Mar 2021 09:52:10 +0000 (11:52 +0200)]
softdep_unmount: assert that no dandling dependencies are left

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agoFFS: assign fully initialized struct mount_softdeps to um_softdep
Konstantin Belousov [Wed, 3 Mar 2021 22:02:30 +0000 (00:02 +0200)]
FFS: assign fully initialized struct mount_softdeps to um_softdep

Other threads observing the non-NULL um_softdep can assume that it is
safe to use it. This is important for ro->rw remounts where change from
read-only to read-write status cannot be made atomic.

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agoAssert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called
Konstantin Belousov [Wed, 3 Mar 2021 19:40:34 +0000 (21:40 +0200)]
Assert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agoffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps
Konstantin Belousov [Wed, 3 Mar 2021 18:02:13 +0000 (20:02 +0200)]
ffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178

3 years agosoftdep_unmount: handle spurious wakeups
Konstantin Belousov [Sun, 28 Feb 2021 22:46:21 +0000 (00:46 +0200)]
softdep_unmount: handle spurious wakeups

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178