]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agopkg(7): indentation fixes
Baptiste Daroussin [Tue, 27 Apr 2021 02:07:05 +0000 (04:07 +0200)]
pkg(7): indentation fixes

Non functional changes

3 years agocxgbe(4): Do not panic when tx is called with invalid checksum requests.
Navdeep Parhar [Wed, 28 Apr 2021 20:45:58 +0000 (13:45 -0700)]
cxgbe(4): Do not panic when tx is called with invalid checksum requests.

There is no need to panic in if_transmit if the checksums requested are
inconsistent with the frame being transmitted.  This typically indicates
that the kernel and driver were built with different INET/INET6 options,
or there is some other kernel bug.  The driver should just throw away
the requests that it doesn't understand and move on.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years ago[fib algo] Update fib_gen counter under FIB_MOD_LOCK.
Alexander V. Chernikov [Wed, 28 Apr 2021 20:21:58 +0000 (20:21 +0000)]
[fib algo] Update fib_gen counter under FIB_MOD_LOCK.

MFC after: 3 days

3 years agocache: remove incomplete lockless lockout support during resize
Mateusz Guzik [Sat, 10 Apr 2021 17:20:28 +0000 (19:20 +0200)]
cache: remove incomplete lockless lockout support during resize

This is already properly handled thanks to 2 step hash replacement.

3 years agoCorrect the link of external mirrors
Li-Wen Hsu [Wed, 28 Apr 2021 19:39:18 +0000 (03:39 +0800)]
Correct the link of external mirrors

Reported by: 0mp
Fixes: 8ef03ce6db33
MFC after: 1 day

3 years agoixgbe: Improve device name strings
Kevin Bowling [Wed, 21 Apr 2021 02:35:14 +0000 (19:35 -0700)]
ixgbe: Improve device name strings

This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts.

Approved by: erj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29876

3 years agopf: Error tracing SDTs
Kristof Provost [Tue, 20 Apr 2021 09:18:26 +0000 (11:18 +0200)]
pf: Error tracing SDTs

Add additional DTrace static trace points to facilitate debugging
failing pf ioctl calls.

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

3 years agoBump __FreeBSD_version for commits efe7f12 and 9781105
Neel Chauhan [Wed, 28 Apr 2021 15:07:05 +0000 (08:07 -0700)]
Bump __FreeBSD_version for commits efe7f12 and 9781105

These commits have added new APIs to linuxkpi.

3 years agolinuxkpi: Introduce tasklet_disable_nosync()
Neel Chauhan [Wed, 28 Apr 2021 15:05:57 +0000 (08:05 -0700)]
linuxkpi: Introduce tasklet_disable_nosync()

This is needed for the drm-kmod 5.5 update.

Reviewed by: hselasky (src)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30024

3 years agolinuxkpi: Implement rcu_replace_pointer() macro
Neel Chauhan [Wed, 28 Apr 2021 15:04:52 +0000 (08:04 -0700)]
linuxkpi: Implement rcu_replace_pointer() macro

This is needed for the drm-kmod 5.5 update.

Reviewed by: hselasky (src)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30025

3 years agopipe: Avoid calling selrecord() on a closing pipe
Mark Johnston [Wed, 28 Apr 2021 14:42:59 +0000 (10:42 -0400)]
pipe: Avoid calling selrecord() on a closing pipe

pipe_poll() may add the calling thread to the selinfo lists of both ends
of a pipe.  It is ok to do this for the local end, since we know we hold
a reference on the file and so the local end is not closed.  It is not
ok to do this for the remote end, which may already be closed and have
called seldrain().  In this scenario, when the polling thread wakes up,
it may end up referencing a freed selinfo.

Guard the selrecord() call appropriately.

Reviewed by: kib
Reported by: syzkaller+KASAN
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30016

3 years agobuild(7): fix references to svn(1) and svnlite(1)
Fernando Apesteguía [Fri, 23 Apr 2021 16:59:19 +0000 (18:59 +0200)]
build(7): fix references to svn(1) and svnlite(1)

Replace them with references to Git.

PR: 254937
Reported by: m.bueker@berlin.de
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29949

3 years agocap_sysctl.3: Fix bugs in the example
Mark Johnston [Wed, 28 Apr 2021 14:38:52 +0000 (10:38 -0400)]
cap_sysctl.3: Fix bugs in the example

- Correct the type of the sysctl value.
- Initialize the oldsize parameter to cap_sysctlbyname()

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agotcp: stop spurious rescue retransmissions and potential asserts
Richard Scheffenegger [Wed, 28 Apr 2021 12:56:14 +0000 (14:56 +0200)]
tcp: stop spurious rescue retransmissions and potential asserts

Reported by: pho@
MFC after: 3 days
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29970

3 years agoUpdate tools/regression/poll/sockpoll.c for POLLRDPOLL.
Thomas Munro [Wed, 28 Apr 2021 11:08:27 +0000 (23:08 +1200)]
Update tools/regression/poll/sockpoll.c for POLLRDPOLL.

Add a POLLRDHUP example to this tool, for comparison with other
operating systems.  Also record current output on FreeBSD and Linux.

Reviewed by:    kib
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D29757

3 years agopoll(2): Add POLLRDHUP.
Thomas Munro [Wed, 28 Apr 2021 09:31:38 +0000 (21:31 +1200)]
poll(2): Add POLLRDHUP.

Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29757

3 years agoopen_memstream(3): fix typo
Yuri Pankov [Wed, 28 Apr 2021 09:18:25 +0000 (12:18 +0300)]
open_memstream(3): fix typo

While here, pet mandoc: .Tn -> .Vt

3 years agoAdd rib_walk_from() wrapper for selective rib tree traversal.
Alexander V. Chernikov [Sun, 25 Apr 2021 11:59:40 +0000 (11:59 +0000)]
Add rib_walk_from() wrapper for selective rib tree traversal.

Provide wrapper for the rnh_walktree_from() rib callback.
As currently `struct rib_head` is considered internal to the
 routing subsystem, this wrapper is necessary to maintain isolation
 from the external code.

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

3 years agocxgbe(4): Add support for NIC suspend/resume and live reset.
Navdeep Parhar [Wed, 28 Apr 2021 04:33:10 +0000 (21:33 -0700)]
cxgbe(4): Add support for NIC suspend/resume and live reset.

Add suspend/resume callbacks to the driver and a live reset built around
them.  This commit covers the basic NIC and future commits will expand
this functionality to other stateful parts of the chip.  Suspend and
resume operate on the chip (the t?nex nexus device) and affect all its
ports.  It is not possible to suspend/resume or reset individual ports.
All these operations can be performed on a running NIC.  A reset will
look like a link bounce to the networking stack.

Here are some ways to exercise this functionality:

 /* Manual suspend and resume. */
 # devctl suspend t6nex0
 # devctl resume t6nex0

 /* Manual reset. */
 # devctl reset t6nex0

 /* Manual reset with driver sysctl. */
 # sysctl dev.t6nex.0.reset=1

 /* Automatic adapter reset on any fatal error. */
 # hw.cxgbe.reset_on_fatal_err=1

Suspend disables the adapter (DMA, interrupts, and the port PHYs) and
marks the hardware as unavailable to the driver.  All ifnets associated
with the adapter are still visible to the kernel but operations that
require hardware interaction will fail with ENXIO.  All ifnets report
link-down while the adapter is suspended.

Resume will reattach to the card, reconfigure it as before, and recreate
the queues servicing the existing ifnets.  The ifnets are able to send
and receive traffic as soon as the link comes back up.

Reset is roughly the same as a suspend and a resume with at least one of
these events in between: D0->D3Hot->D0, FLR, PCIe link retrain.

MFC after: 1 month
Relnotes: yes
Sponsored by: Chelsio Communications

3 years agogeom_uzip(4): fix a typo
Ceri Davies [Wed, 28 Apr 2021 04:55:32 +0000 (00:55 -0400)]
geom_uzip(4): fix a typo

While I was there, also fixed a whitespace issue reported by mandoc
-Tlint.

PR: 254338
MFC after: 3 days

3 years agonfscl: add check for NULL clp and forced dismounts to nfscl_delegreturnvp()
Rick Macklem [Wed, 28 Apr 2021 00:30:16 +0000 (17:30 -0700)]
nfscl: add check for NULL clp and forced dismounts to nfscl_delegreturnvp()

Commit aad780464fad added a function called nfscl_delegreturnvp()
to return delegations during the NFS VOP_RECLAIM().
The function erroneously assumed that nm_clp would
be non-NULL. It will be NULL for NFSV4.0 mounts until
a regular file is opened. It will also be NULL during
vflush() in nfs_unmount() for a forced dismount.

This patch adds a check for clp == NULL to fix this.

Also, since it makes no sense to call nfscl_delegreturnvp()
during a forced dismount, the patch adds a check for that
case and does not do the call during forced dismounts.

PR: 255436
Reported by: ish@amail.plala.or.jp
MFC after: 2 weeks

3 years agonfsd: fix a NFSv4.1 Linux client mount stuck in CLOSE_WAIT
Rick Macklem [Tue, 27 Apr 2021 22:32:35 +0000 (15:32 -0700)]
nfsd: fix a NFSv4.1 Linux client mount stuck in CLOSE_WAIT

It was reported that a NFSv4.1 Linux client mount against
a FreeBSD12 server was hung, with the TCP connection in
CLOSE_WAIT state on the server.
When a NFSv4.1/4.2 mount is done and the back channel is
bound to the TCP connection, the soclose() is delayed until
a new TCP connection is bound to the back channel, due to
a reference count being held on the SVCXPRT structure in
the krpc for the socket. Without the soclose() call, the socket
will remain in CLOSE_WAIT and this somehow caused the Linux
client to hang.

This patch adds calls to soshutdown(.., SHUT_WR) that
are performed when the server side krpc sees that the
socket is no longer usable.  Since this can be done
before the back channel is bound to a new TCP connection,
it allows the TCP connection to proceed to CLOSED state.

PR: 254590
Reported by: jbreitman@tildenparkcapital.com
Reviewed by: tuexen
Comments by: kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29526

3 years agoe1000: Rework em_msi_link interrupt filter
Kevin Bowling [Sun, 25 Apr 2021 08:22:23 +0000 (01:22 -0700)]
e1000: Rework em_msi_link interrupt filter

* Fix 82574 Link Status Changes, carrying the OTHER mask bit around as
  needed.
* Move igb-class LSC re-arming out of FAST back into the handler.
* Clarify spurious/other interrupt re-arms in FAST.

In MSI-X mode, 82574 and igb-class devices use an interrupt filter to
handle Link Status Changes. We want to do LSC re-arms in the handler
to take advantage of autoclear (EIAC) single shot behavior.

82574 uses 'Other' in ICR and IMS for LSC interrupt types when in MSI-X
mode, so we need to set and re-arm the 'Other' bit during attach and
after ICR reads in the FAST handler if not an LSC or after handling on
LSC due to autoclearing.

This work was primarily done to address the referenced PR, but inspired
some clarification and improvement for igb-class devices once the
intentions of previous bug fix attempts became clearer.

PR: 211219
Reported by: Alexey <aserp3@gmail.com>
Tested by: kbowling (I210 lagg), markj (I210)
Approved by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29943

3 years ago[fib algo] Delay algo init at fib growth to to allow to reliably use rib KPI.
Alexander V. Chernikov [Sun, 25 Apr 2021 10:22:45 +0000 (10:22 +0000)]
[fib algo] Delay algo init at fib growth to to allow to reliably use rib KPI.

Currently, most of the rib(9) KPI does not use rnh pointers, using
 fibnum and family parameters to determine the rib pointer instead.
This works well except for the case when we initialize new rib pointers
 during fib growth.
In that case, there is no mapping between fib/family and the new rib,
 as an entirely new rib pointer array is populated.

Address this by delaying fib algo initialization till after switching
 to the new pointer array and updating the number of fibs.
Set datapath pointer to the dummy function, so the potential callers
 won't crash the kernel in the brief moment when the rib exists, but
 no fib algo is attached.

This change allows to avoid creating duplicates of existing rib functions,
 with altered signature.

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

3 years agoriscv: Remove old qemu compatibility code
Brandon Bergren [Tue, 27 Apr 2021 16:07:34 +0000 (11:07 -0500)]
riscv: Remove old qemu compatibility code

During early qemu development, the /soc node was marked as compatible
with "riscv-virtio-soc" instead of "simple-bus".

This was changed in qemu 53f54508dae6 in Sep 2018, and predates the
baseline required qemu version (5.0) for riscv by a wide margin.

The generic simplebus code handles attachment in all cases nowadays.

Sponsored by: Tag1 Consulting, Inc.
Reviewed by: jrtc27, mhorne
Differential Revision: https://reviews.freebsd.org/D30011

3 years agoMerge llvm commits for kernel address and memory sanitizer support
Dimitry Andric [Tue, 27 Apr 2021 19:18:13 +0000 (21:18 +0200)]
Merge llvm commits for kernel address and memory sanitizer support

Merge commit 99eca1bd9c7a from llvm git (by Mark Johnston):

  [Driver] Enable kernel address and memory sanitizers on FreeBSD

  Test Plan: using kernel ASAN and MSAN implementations in FreeBSD

  Reviewed By: emaste, dim, arichardson

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

Merge commit f511dc75e4c1 from llvm git (by Mark Johnston):

  [asan] Add an offset for the kernel address sanitizer on FreeBSD

  This is based on a port of the sanitizer runtime to the FreeBSD kernel
  that has been commited as https://cgit.freebsd.org/src/commit/?id=38da497a4dfcf1979c8c2b0e9f3fa0564035c147
  and the following commits.

  Reviewed By: emaste, dim
  Differential Revision: https://reviews.llvm.org/D98285

Requested by: markj
MFC after: 3 days

3 years agoMove IOMMU code to a separate pmap module and switch ARM System MMU
Ruslan Bukin [Tue, 27 Apr 2021 17:59:15 +0000 (18:59 +0100)]
Move IOMMU code to a separate pmap module and switch ARM System MMU
driver to use it.

Add ARM Mali Txxx (Midgard), Gxx (Bifrost) GPU page management code.

Sponsored by: UKRI

3 years agodwc: Use mii_fdt function
Emmanuel Vadot [Sun, 11 Apr 2021 19:34:57 +0000 (21:34 +0200)]
dwc: Use mii_fdt function

Use the helper function to get phy mode and configure dwc accordingly.

Reviewed by: ian

3 years agommccam: probe*: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:51:13 +0000 (14:51 +0200)]
mmccam: probe*: Style(9)

3 years agommcprobe_done: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:50:04 +0000 (14:50 +0200)]
mmcprobe_done: Style(9)

3 years agodwmmc: Add \n to a debug printf
Emmanuel Vadot [Thu, 22 Apr 2021 19:41:56 +0000 (21:41 +0200)]
dwmmc: Add \n to a debug printf

3 years agommc: dwmmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:56:27 +0000 (13:56 +0200)]
mmc: dwmmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27487
Reviewed by: kibab

3 years agoallwinner: aw_mmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:54:25 +0000 (13:54 +0200)]
allwinner: aw_mmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27486
Reviewed by: imp

3 years agommccam: Add mmc_sim, a generic sim for mmc driver to use
Emmanuel Vadot [Wed, 21 Apr 2021 11:52:29 +0000 (13:52 +0200)]
mmccam: Add mmc_sim, a generic sim for mmc driver to use

This adds a generic sim that abstract a lot of what needs to be implemented
in a driver for mmccam support.
A new interface with three methods is added :

 - mmc_sim_get_tran_settings: Use to get what the controller supports in term
   of capabilities, freq etc ...
 - mmc_sim_set_tran_settings: Use to change the speed/freq/etc of the
   sdcard host controller
 - mmc_sim_cam_request: Used for MMCIO requests

Differential Revision: https://reviews.freebsd.org/D27485
Reviewed by: kibab

3 years agoConsider the broken card detect flag that comes from 'broken-cd;'
Ruslan Bukin [Tue, 27 Apr 2021 11:19:05 +0000 (12:19 +0100)]
Consider the broken card detect flag that comes from 'broken-cd;'
dts property.

This fixes operation on Intel Stratix 10 devices.

Tested on Terasic DE10-Pro.

Reviewed by: manu
Sponsored by: UKRI
Differential revision: https://reviews.freebsd.org/D29999

3 years agosctp: cleanup verification of INIT and INIT-ACK chunks
Michael Tuexen [Tue, 27 Apr 2021 10:45:14 +0000 (12:45 +0200)]
sctp: cleanup verification of INIT and INIT-ACK chunks

3 years agopf tests: Test using '<ifgroup>:network' in tables
Kristof Provost [Sun, 25 Apr 2021 10:18:48 +0000 (12:18 +0200)]
pf tests: Test using '<ifgroup>:network' in tables

MFC after: 1 week

3 years agopfctl: Revert "pfctl: Another set skip <group> fix"
Kristof Provost [Mon, 26 Apr 2021 08:07:07 +0000 (10:07 +0200)]
pfctl: Revert "pfctl: Another set skip <group> fix"

This reverts commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a.
This fix broke using '<ifgroup>:network' in tables.

MFC after: 1 week

3 years ago[fib algo] always commit static routes synchronously.
Alexander V. Chernikov [Tue, 27 Apr 2021 08:23:29 +0000 (08:23 +0000)]
[fib algo] always commit static routes synchronously.

Modular fib lookup framework features logic that allows
 route update batching for the algorithms that cannot easily
 apply the routing change without rebuilding. As a result,
 dataplane lookups may return old data until the the sync
 takes place. With the default sync timeout of 50ms, it is
 possible that new binary like ping(8) executed exactly after
 route(8) will still use the old fib data.

To address some aspects of the problem, framework executes
 all rtable changes without RTF_GATEWAY synchronously.

To fix the aforementioned problem, this diff extends sync
 execution for all RTF_STATIC routes (e.g. ones maintained by
 route(8).
This fixes a bunch of tests in the networking space.

Reported by: ci, arichardson
MFC after: 2 weeks

3 years agoFix rtsock sockaddr alignment.
Alexander V. Chernikov [Tue, 27 Apr 2021 08:04:19 +0000 (08:04 +0000)]
Fix rtsock sockaddr alignment.

b31fbebeb3 introduced alloc_sockaddr_aligned() which, in fact,
 failed to produce aligned addresses.

Reported by: Oskar Holmlund <oskar.holmlund at yahoo.com>
MFC after: immediately

3 years agoFix drace CTF for the rib_head.
Alexander V. Chernikov [Tue, 27 Apr 2021 07:47:53 +0000 (07:47 +0000)]
Fix drace CTF for the rib_head.

33cb3cb2e321 introduced an `rib_head` structure field under the
FIB_ALGO define. This may be problematic for the CTF, as some
 of the files including `route_var.h` do not have `fib_algo`
 defined.

Make dtrace happy by making the field unconditional.

Suggested by: markj

3 years agopw(8): use openmemstream instead of sbuf(9)
Baptiste Daroussin [Tue, 27 Apr 2021 03:05:13 +0000 (05:05 +0200)]
pw(8): use openmemstream instead of sbuf(9)

3 years agoMake pkg(7) use environment variables specified in pkg.conf
Moritz Schmitt [Tue, 27 Apr 2021 01:59:12 +0000 (03:59 +0200)]
Make pkg(7) use environment variables specified in pkg.conf

Modify /usr/sbin/pkg to use environment variables specified in pkg.conf.
This allows control over underlying libraries like fetch(3), which can
be configured by setting HTTP_PROXY.

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

3 years agoClean up fsck_ffs error message output.
Kirk McKusick [Tue, 27 Apr 2021 01:42:48 +0000 (18:42 -0700)]
Clean up fsck_ffs error message output.

When fsck_ffs is creating a lost+found directory it must allocate
an inode and a filesystem block. If it encounters a cylinder group
with a bad check hash, it complains twice: once for the inode and
again for the filesystem block.

This change suppresses the second complaint.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

3 years agonfscl: fix the handling of NFSERR_DELAY for Open/LayoutGet RPCs
Rick Macklem [Tue, 27 Apr 2021 00:48:21 +0000 (17:48 -0700)]
nfscl: fix the handling of NFSERR_DELAY for Open/LayoutGet RPCs

For a pNFS mount, the NFSv4.1/4.2 client uses compound RPCs that
have both Open and LayoutGet operations in them.
If the pNFS server were tp reply NFSERR_DELAY for one of these
compounds, the retry after a delay cannot be handled by
newnfs_request(), since there is a reference held on the open
state for the Open operation in them.

Fix this by adding these RPCs to the "don't do delay here"
list in newnfs_request().

This patch is only needed if the mount is using pNFS (the "pnfs"
mount option) and probably only matters if the MDS server
is issuing delegations as well as pNFS layouts.

Found by code inspection.

MFC after: 2 weeks

3 years agoUPDATING: add an entry for commit 875977314881
Rick Macklem [Mon, 26 Apr 2021 23:45:26 +0000 (16:45 -0700)]
UPDATING: add an entry for commit 875977314881

3 years agoMake fsck_ffs more persistent in creating a lost+found directory.
Kirk McKusick [Mon, 26 Apr 2021 23:47:27 +0000 (16:47 -0700)]
Make fsck_ffs more persistent in creating a lost+found directory.

When fsck_ffs is running in interactive mode and finds unlinked files,
it offers to either unlink them or place them in a lost+found directory.
If the lost+found directory option is requested and no lost+found
directory exists, fsck_ffs offers to create one. When creating one,
it must allocate an inode and a filesystem block. It attempts to
allocate them from the first cylinder group. If the first cylinder
group has a bad check hash, it gives up.

This change expands the search into later cylinder groups when the
first one fails with a bad check hash.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

3 years agoparam.h: bump __FreeBSD_version for commit 875977314881
Rick Macklem [Mon, 26 Apr 2021 23:35:18 +0000 (16:35 -0700)]
param.h: bump __FreeBSD_version for commit 875977314881

Commit 875977314881 changed the internal KPI between the
nfsd and nfscommon modules, so both need to be rebuilt
from sources.

3 years agonfsd: fix the slot sequence# when a callback fails
Rick Macklem [Mon, 26 Apr 2021 23:24:10 +0000 (16:24 -0700)]
nfsd: fix the slot sequence# when a callback fails

Commit 4281bfec3628 patched the server so that the
callback session slot would be free'd for reuse when
a callback attempt fails.
However, this can often result in the sequence# for
the session slot to be advanced such that the client
end will reply NFSERR_SEQMISORDERED.

To avoid the NFSERR_SEQMISORDERED client reply,
this patch negates the sequence# advance for the
case where the callback has failed.
The common case is a failed back channel, where
the callback cannot be sent to the client, and
not advancing the sequence# is correct for this
case.  For the uncommon case where the client's
reply to the callback is lost, not advancing the
sequence# will indicate to the client that the
next callback is a retry and not a new callback.
But, since the FreeBSD server always sets "csa_cachethis"
false in the callback sequence operation, a retry
and a new callback should be handled the same way
by the client, so this should not matter.

Until you have this patch in your NFSv4.1/4.2 server,
you should consider avoiding the use of delegations.
Even with this patch, interoperation with the
Linux NFSv4.1/4.2 client in kernel versions prior
to 5.3 can result in frequent 15second delays if
delegations are enabled.  This occurs because, for
kernels prior to 5.3, the Linux client does a TCP
reconnect every time it sees multiple concurrent
callbacks and then it takes 15seconds to recover
the back channel after doing so.

MFC after: 2 weeks

3 years agocxgbe(4): Separate the sw- and hw-specific parts of resource allocations
Navdeep Parhar [Mon, 26 Apr 2021 21:03:06 +0000 (14:03 -0700)]
cxgbe(4): Separate the sw- and hw-specific parts of resource allocations

The driver uses both software resources (locks, callouts, memory for
descriptors and for bookkeeping, sysctls, etc.) and hardware resources
(VIs, DMA queues, TCAM entries, etc.) to operate the NIC.  This commit
splits the single *_ALLOCATED flag used to track all these resources
into separate *_SW_ALLOCATED and *_HW_ALLOCATED flags.

This is the simplified pseudocode that now applies to most queues (foo
can be ctrlq/txq/rxq/ofld_txq/ofld_rxq):

/* Idempotent */
alloc_foo
{
if (!SW_ALLOCATED)
init_iq/init_eq/init_fl no-fail sw init
alloc_iq_fl/alloc_eq/alloc_wrq may-fail sw alloc
add_foo_sysctls, etc. no-fail post-alloc items
if (!HW_ALLOCATED)
alloc_iq_fl_hwq/alloc_eq_hwq hw resource allocation
}

/* Idempotent */
free_foo
{
if (!HW_ALLOCATED)
free_iq_fl_hwq/free_eq_hwq release hw resources
if (!SW_ALLOCATED)
free_iq_fl/free_eq/free_wrq release sw resources
}

The routines that take the driver to FULL_INIT_DONE and VI_INIT_DONE and
back are now all idempotent.  The quiesce routines pay attention to the
HW_ALLOCATED flag and will not wait on the hardware for pidx/cidx
updates and other completions if this flag is not set.

MFC after: 1 month
Sponsored by: Chelsio Communications

3 years agosctp: improve handling of illegal packets containing INIT chunks
Michael Tuexen [Mon, 26 Apr 2021 08:38:05 +0000 (10:38 +0200)]
sctp: improve handling of illegal packets containing INIT chunks

Stop further processing of a packet when detecting that it
contains an INIT chunk, which is too small or is not the only
chunk in the packet. Still allow to finish the processing
of chunks before the INIT chunk.

Thanks to Antoly Korniltsev and Taylor Brandstetter for reporting
an issue with the userland stack, which made me aware of this
issue.

MFC after: 3 days

3 years agozfs: restore copyright disclaimer change from 4b84b4cca
Martin Matuska [Mon, 26 Apr 2021 20:03:30 +0000 (22:03 +0200)]
zfs: restore copyright disclaimer change from 4b84b4cca

The change will be pull-requested to upstream.

X-MFC-with: 4b84b4cca472e482bc22d5e5c7928be5a1393c84

3 years agopkgbase: Remove package name mangling in generate-ucl.sh
Mark Johnston [Mon, 26 Apr 2021 19:15:31 +0000 (15:15 -0400)]
pkgbase: Remove package name mangling in generate-ucl.sh

The mangling was present in the initial revision of the script, but its
purpose is not clear.  It may have been to avoid defining make(1)
variables with a dash in the name, but this is permitted.  Furthermore,
it results in invalid dependency information if a dependency's name
contains an underscore, causing e.g., libcompiler_rt-dev to depend on
libcompiler-rt, and resulting in warnings when installing base system
packages.  Remove the mangling.

Reviewed by: manu
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29883

3 years agoimgact_elf: Ensure that the return value in parse_notes is initialized
Mark Johnston [Mon, 26 Apr 2021 18:53:16 +0000 (14:53 -0400)]
imgact_elf: Ensure that the return value in parse_notes is initialized

parse_notes relies on the caller-supplied callback to initialize "res".
Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and
the latter fails to initialize res.  Fix it.

In the worst case, the bug would cause the inner loop of check_note to
examine more program headers than necessary, and the note header usually
comes last anyway.

Reviewed by: kib
Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29986

3 years agonewbus: remove support for SINGLETON
Warner Losh [Mon, 26 Apr 2021 17:04:15 +0000 (11:04 -0600)]
newbus: remove support for SINGLETON

Revert rest of de8dd262c43b since it's now unused.

jhibbits@ introduced this to give powerpc MMU functions IFUNC like
performance while retaining the kobj interface, speeding up operations
10-20%. Since there was only ever one instance of the mmu interface
active at any given time, we could cache the looked up results more
agressively.

powerpc migrated to using IFUNCs to get an even larger performance boost
in 45b69dd63e, deleting the two files it was added to in de8dd262c43b.

However, there's few, if any, other potential applications of this to
the tree today. It's now unused and undocumented. Retire it to eliminate
this wart and to preclude the need to document it. Should a simmilar
case arise in the future, the code is in git...

Discusssed with: jhibbits@
Reviewed by: jhb@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29997

3 years agoetcupdate: Add -D destdir to usage for 'extract'.
John Baldwin [Mon, 26 Apr 2021 16:49:34 +0000 (09:49 -0700)]
etcupdate: Add -D destdir to usage for 'extract'.

Reported by: Mark Millard <marklmi@yahoo.com>
MFC after: 1 week

3 years agoe1000: Fix register name in reg_dump sysctl
Kevin Bowling [Mon, 26 Apr 2021 16:30:54 +0000 (09:30 -0700)]
e1000: Fix register name in reg_dump sysctl

The correct name of this register is CTRL_EXT.

Approved by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29967

3 years agopf tests: Test automatically generated tables
Kristof Provost [Mon, 26 Apr 2021 09:14:44 +0000 (11:14 +0200)]
pf tests: Test automatically generated tables

Add a test case where the pfctl optimizer will generate a table
automatically. These tables have long names, which we accidentally broke
in the nvlist ADDRULE ioctl.

Reviewed by: melifaro
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29989

3 years agopf: Fix parsing of long table names
Kristof Provost [Sat, 24 Apr 2021 13:55:24 +0000 (15:55 +0200)]
pf: Fix parsing of long table names

When parsing the nvlist for a struct pf_addr_wrap we unconditionally
tried to parse "ifname". This broke for PF_ADDR_TABLE when the table
name was longer than IFNAMSIZ. PF_TABLE_NAME_SIZE is longer than
IFNAMSIZ, so this is a valid configuration.

Only parse (or return) ifname or tblname for the corresponding
pf_addr_wrap type.

This manifested as a failure to set rules such as these, where the pfctl
optimiser generated an automatic table:

pass in proto tcp to 192.168.0.1 port ssh
pass in proto tcp to 192.168.0.2 port ssh
pass in proto tcp to 192.168.0.3 port ssh
pass in proto tcp to 192.168.0.4 port ssh
pass in proto tcp to 192.168.0.5 port ssh
pass in proto tcp to 192.168.0.6 port ssh
pass in proto tcp to 192.168.0.7 port ssh

Reported by: Florian Smeets
Tested by: Florian Smeets
Reviewed by: donner
X-MFC-With: 5c11c5a3655842a176124ef2334fcdf830422c8a
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29962

3 years agolinuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()
Neel Chauhan [Mon, 26 Apr 2021 15:25:33 +0000 (08:25 -0700)]
linuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()

3 years agolinuxkpi: Elimiate brackets on return in spinlock.h
Neel Chauhan [Mon, 26 Apr 2021 15:16:48 +0000 (08:16 -0700)]
linuxkpi: Elimiate brackets on return in spinlock.h

3 years agolinuxkpi: Implement atomic_dec_and_lock_irqsave()
Neel Chauhan [Mon, 26 Apr 2021 15:15:49 +0000 (08:15 -0700)]
linuxkpi: Implement atomic_dec_and_lock_irqsave()

This is needed by the drm-kmod 5.5 update.

Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29988

3 years agolinuxkpi: Implement the wait_event_interruptible macro
Neel Chauhan [Mon, 26 Apr 2021 15:12:18 +0000 (08:12 -0700)]
linuxkpi: Implement the wait_event_interruptible macro

This is needed by the drm-kmod 5.5 update and is similar in logic to the
existing wait_event_killable macro.

Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29987

3 years agopfsync: Expose PFSYNCF_OK flag to userspace
Kristof Provost [Fri, 23 Apr 2021 12:24:59 +0000 (14:24 +0200)]
pfsync: Expose PFSYNCF_OK flag to userspace

Add 'syncok' field to ifconfig's pfsync interface output. This allows
userspace to figure out when pfsync has completed the initial bulk
import.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29948

3 years agopf tests: Test killing states with multiple labels
Kristof Provost [Wed, 21 Apr 2021 14:12:48 +0000 (16:12 +0200)]
pf tests: Test killing states with multiple labels

Now that we support having multiple labels on a rule ensure that we can
use each rule label to kill states.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29938

3 years agopf: Allow multiple labels to be set on a rule
Kristof Provost [Tue, 20 Apr 2021 09:04:48 +0000 (11:04 +0200)]
pf: Allow multiple labels to be set on a rule

Allow up to 5 labels to be set on each rule.
This offers more flexibility in using labels. For example, it replaces
the customer 'schedule' keyword used by pfSense to terminate states
according to a schedule.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29936

3 years agorc: remove the 'addswap' script.
Edward Tomasz Napierala [Mon, 26 Apr 2021 09:17:31 +0000 (10:17 +0100)]
rc: remove the 'addswap' script.

It's been unused since 268a55bc98b.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29749

3 years agosctp: small cleanup, no functional change
Michael Tuexen [Mon, 26 Apr 2021 00:56:48 +0000 (02:56 +0200)]
sctp: small cleanup, no functional change

MFC: 3 days

3 years agoe1000: Improve device name strings
Kevin Bowling [Wed, 21 Apr 2021 05:27:48 +0000 (22:27 -0700)]
e1000: Improve device name strings

This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts (this driver covers over 20 years
of silicon)

Reviewed by: erj
Approved by: markj
Sponsored by: Pink Floyd - Any Colour You Like (in kind)
Differential Revision: https://reviews.freebsd.org/D29872

3 years agoiflib: Improve mapping of TX/RX queues to CPUs
Patrick Kelsey [Mon, 26 Apr 2021 04:25:59 +0000 (00:25 -0400)]
iflib: Improve mapping of TX/RX queues to CPUs

iflib now supports mapping each (TX,RX) queue pair to the same CPU
(default), to separate CPUs, or to a pair of physical and logical CPUs
that share the same L2 cache.  The mapping mechanism supports unequal
numbers of TX and RX queues, with the excess queues always being
mapped to consecutive physical CPUs.  When the platform cannot
distinguish between physical and logical CPUs, all are treated as
physical CPUs.  See the comment on get_cpuid_for_queue() for the
entire matrix.

The following device-specific tunables influence the mapping process:
dev.<device>.<unit>.iflib.core_offset       (existing)
dev.<device>.<unit>.iflib.separate_txrx     (existing)
dev.<device>.<unit>.iflib.use_logical_cores (new)

The following new, read-only sysctls provide visibility of the mapping
results:
dev.<device>.<unit>.iflib.{t,r}xq<n>.cpu

When an iflib driver allocates TX softirqs without providing reference
RX IRQs, iflib now binds those TX softirqs to CPUs using the above
mapping mechanism (that is, treats them as if they were TX IRQs).
Previously, such bindings were left up to the grouptaskqueue code and
thus fell outside of the iflib CPU mapping strategy.

Reviewed by: kbowling
Tested by: olivier, pkelsey
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D24094

3 years agozfs: fix non-functional mismerges from vendor/openzfs
Martin Matuska [Mon, 26 Apr 2021 01:05:13 +0000 (03:05 +0200)]
zfs: fix non-functional mismerges from vendor/openzfs

- fix copyright in module/os/freebsd/spl/spl_acl.c
- fix mismerge in non-processed module/os/linux/zfs/zfs_uio.c

MFC after:      3 days
Obtained from:  OpenZFS

3 years agonfscl: return delegations in the NFS VOP_RECLAIM()
Rick Macklem [Mon, 26 Apr 2021 00:57:55 +0000 (17:57 -0700)]
nfscl: return delegations in the NFS VOP_RECLAIM()

After a vnode is recycled it can no longer be
acquired via vfs_hash_get() and, as such,
a delegation for the vnode cannot be recalled.

In the unlikely event that a delegation still
exists when the vnode is being recycled, return
the delegation since it will no longer be
recallable.

Until you have this patch in your NFSv4 client,
you should consider avoiding the use of delegations.

MFC after: 2 weeks

3 years agoRevert "Add workaround for a QoS-related bug in VMWare Workstation."
Ed Maste [Sun, 25 Apr 2021 21:14:23 +0000 (17:14 -0400)]
Revert "Add workaround for a QoS-related bug in VMWare Workstation."

This reverts commit 77c2fe20df6a9a7c1a353e1a4ab2ba80fefab881.

The VMware Workstation issue was fixed in 2019[1], and we'd rather not
carry unnecessary local changes in OpenSSH.

[1] https://communities.vmware.com/t5/VMware-Workstation-Pro/Regression-ssh-results-in-broken-pipe-upon-connecting-in-Vmware/m-p/486105/highlight/true#M25470

PR: 234426
Discussed with: yuripv
Approved by: des
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agonfscl: fix delegation recall when the file is not open
Rick Macklem [Sun, 25 Apr 2021 19:52:48 +0000 (12:52 -0700)]
nfscl: fix delegation recall when the file is not open

Without this patch, if a NFSv4 server recalled a
delegation when the file is not open, the renew
thread would block in the NFS VOP_INACTIVE()
trying to acquire the client state lock that it
already holds.

This patch fixes the problem by delaying the
vrele() call until after the client state
lock is released.

This bug has been in the NFSv4 client for
a long time, but since it only affects
delegation when recalled due to another
client opening the file, it got missed
during previous testing.

Until you have this patch in your client,
you should avoid the use of delegations.

MFC after: 2 weeks

3 years agoFix NOINET[6],!VIMAGE builds after FIB_ALGO addition to GENERIC
Alexander V. Chernikov [Wed, 21 Apr 2021 04:52:38 +0000 (05:52 +0100)]
Fix NOINET[6],!VIMAGE builds after FIB_ALGO addition to GENERIC

Reported by: jbeich
PR: 255390

3 years agoAdd code examples to cpuset(2), and improve cross referencing.
Robert Watson [Sun, 25 Apr 2021 14:22:00 +0000 (15:22 +0100)]
Add code examples to cpuset(2), and improve cross referencing.

MFC after: 1 week
Reviewed by: jeff, jrtc27, kevans, bcr (manpages)
Differential revision: https://reviews.freebsd.org/D27803

3 years agokern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW
Edward Tomasz Napierala [Sun, 25 Apr 2021 13:13:02 +0000 (14:13 +0100)]
kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW

This makes this API match other kern_xxxat() functions.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29776

3 years agorc: improve dependencies for growfs
Edward Tomasz Napierala [Sun, 25 Apr 2021 12:41:36 +0000 (13:41 +0100)]
rc: improve dependencies for growfs

Previously it depended on sysctl, which itself has no dependencies,
so rcorder(8) had a bit too much flexibility when choosing when to run
it.  Make sure it runs just between 'fsck' and 'root'.

Reviewed By: jmg, imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29748

3 years agoFix NOINET[6] build after enabling FIB_ALGO in GENERIC.
Alexander V. Chernikov [Wed, 21 Apr 2021 01:45:49 +0000 (02:45 +0100)]
Fix NOINET[6] build after enabling FIB_ALGO in GENERIC.

Submitted by: jbeich
PR: 255389

3 years ago[fib algo] Do not print algo attach/detach message on boot
Alexander V. Chernikov [Sun, 25 Apr 2021 08:51:57 +0000 (08:51 +0000)]
[fib algo] Do not print algo attach/detach message on boot

MFC after: 1 day

3 years agoMake gcc happy by initializing error in rib_handle_ifaddr_info().
Alexander V. Chernikov [Sun, 25 Apr 2021 08:44:20 +0000 (08:44 +0000)]
Make gcc happy by initializing error in rib_handle_ifaddr_info().

3 years agoFix build with gcc
Stefan Eßer [Sun, 25 Apr 2021 08:15:17 +0000 (10:15 +0200)]
Fix build with gcc

Correctly declare function without arguments as f(void) instead of f().

3 years agoMerge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'
Stefan Eßer [Sun, 25 Apr 2021 06:42:31 +0000 (08:42 +0200)]
Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'

usr.bin/bc: update to version 4.0.1

This update adds a flush() of the output buffer to the bc print command.

3 years agoVendor import of Gavin D. Howards bc version 4.0.1
Stefan Eßer [Sun, 25 Apr 2021 06:36:50 +0000 (08:36 +0200)]
Vendor import of Gavin D. Howards bc version 4.0.1

3 years agoAdd FIB_ALGO to GENERIC on amd64/arm64.
Alexander V. Chernikov [Sat, 24 Apr 2021 23:05:04 +0000 (23:05 +0000)]
Add FIB_ALGO to GENERIC on amd64/arm64.

Option `FIB_ALGO` gates new modular fib lookup functionality,
 enabling more performant routing table lookups and improving
 control plane convergence under the load.

Detailed feature description is available in D27401.

Reviewed By: olivier, gnn
Differential Revision: https://reviews.freebsd.org/D28434

3 years ago[rtsock] Enforce netmask/RTF_HOST consistency.
Alexander V. Chernikov [Fri, 23 Apr 2021 21:53:47 +0000 (21:53 +0000)]
[rtsock] Enforce netmask/RTF_HOST consistency.

Traditionally we had 2 sources of information whether the
 added/delete route request targets network or a host route:
netmask (RTA_NETMASK) and RTF_HOST flag.

The former one is tricky: netmask can be empty or can explicitly
 specify the host netmask. Parsing netmask sockaddr requires per-family
 parsing and that's what rtsock code traditionally avoided. As a result,
 consistency was not enforced and it was possible to specify network with
 the RTF_HOST flag and vice versa.

Continue normalization efforts from D29826 and D29826 and ensure that
 RTF_HOST flag always reflects host/network data from netmask field.

Differential Revision: https://reviews.freebsd.org/D29958
MFC after: 2 days

3 years agoImprove debugging output on routing tests failure.
Alexander V. Chernikov [Fri, 23 Apr 2021 21:28:38 +0000 (21:28 +0000)]
Improve debugging output on routing tests failure.

Most of the routing tests create per-test VNET, making
 it harder to repeat the failure with CLI tools.
Provide an additional route/nexthop data on failure.

Differential Revision: https://reviews.freebsd.org/D29957
Reviewed by: kp
MFC after: 2 weeks

3 years agotcp: fix man page
Michael Tuexen [Sat, 24 Apr 2021 20:31:36 +0000 (22:31 +0200)]
tcp: fix man page

Reviewed by: gbe, rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D29963

3 years agoSupport run-time configuration of the PIPE_MINDIRECT threshold.
Robert Watson [Sat, 2 Jan 2021 16:42:28 +0000 (16:42 +0000)]
Support run-time configuration of the PIPE_MINDIRECT threshold.
PIPE_MINDIRECT determines at what (blocking) write size one-copy
optimizations are applied in pipe(2) I/O.  That threshold hasn't
been tuned since the 1990s when this code was originally
committed, and allowing run-time reconfiguration will make it
easier to assess whether contemporary microarchitectures would
prefer a different threshold.

(On our local RPi4 baords, the 8k default would ideally be at least
32k, but it's not clear how generalizable that observation is.)

MFC after: 3 weeks
Reviewers: jrtc27, arichardson
Differential Revision: https://reviews.freebsd.org/D29819

3 years agohkbd: Fix typo which disables keyboard input in kdb
Vladimir Kondratyev [Sat, 24 Apr 2021 18:49:27 +0000 (21:49 +0300)]
hkbd: Fix typo which disables keyboard input in kdb

Reported by: Greg V
MFC after: 1 week

3 years agolinux: make ptrace(2) return EIO when trying to peek invalid address
Edward Tomasz Napierala [Sat, 24 Apr 2021 10:37:06 +0000 (11:37 +0100)]
linux: make ptrace(2) return EIO when trying to peek invalid address

Previously we've returned the error from native ptrace(2), ENOMEM.
This confused Linux strace(2).

Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29925

3 years agoAllow the tcp_lro_flush_all() function to be called when the control
Hans Petter Selasky [Sat, 24 Apr 2021 10:20:33 +0000 (12:20 +0200)]
Allow the tcp_lro_flush_all() function to be called when the control
structure is zeroed, by setting the VNET after checking the mbuf count
for zero. It appears there are some cases with early interrupts on some
network devices which still trigger page-faults on accessing a NULL "ifp"
pointer before the TCP LRO control structure has been initialized.
This basically preserves the old behaviour, prior to
9ca874cf740ee68c5742df8b5f9e20910085c011 .

No functional change.

Reported by: rscheff@
Differential Revision: https://reviews.freebsd.org/D29564
MFC after: 2 weeks
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agompr/mps(4): Make device mapping some more robust.
Alexander Motin [Sat, 24 Apr 2021 03:18:01 +0000 (23:18 -0400)]
mpr/mps(4): Make device mapping some more robust.

Allow new enclosure to replace previously existing one if there is
no completely unused table entry, same as it is done for devices.

If we can not process DPM due to corruption -- wipe it and restart
from scratch.  Otherwise I don't see a way to recover persistence if
something go wrong and there is no BIOS to recover it for us.

Together this solves a problem that appeared when 9300-8i firmware
update to 16.00.10.00 somehow switched its mapping mode from Device
Persistence to Enclosure/Slot without wiping the DPM table.  It made
HBA completely unusable, since overflowed and conflicting mapping
table was unable to map any of enclosures and so devices.

Also while there make some enclosure mapping errors more informative.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

3 years agosound(4): fixing panic for INVARIANTS kernel
Tai-hwa Liang [Thu, 22 Apr 2021 12:45:18 +0000 (12:45 +0000)]
sound(4): fixing panic for INVARIANTS kernel

3e7bae08210e0 turns the BUS_READ_IVAR() failure from a warning into a
KASSERT.  For certain PCI audio devices such like snd_csa(4) and
snd_emu10kx(4), the ac97_create() keeps the device handler generated
by device_add_child(pci_dev, "pcm"), which is not really a PCI device
handler.  This in turn causes the subsequent pci_get_subdevice()
inside ac97_initmixer() triggering a panic.

This patch tries to put a bandaid for the aforementioned pcm device
children such that they can use the correct PCI handler(from parent)
to avoid a KASSERT panic in the INVARIANTS kernel.

Tested with: snd_csa(4), snd_ich(4), snd_emu10kx(4)
Reviewed by: imp
MFC after: 1 month

3 years agonfsd: fix session slot handling for failed callbacks
Rick Macklem [Fri, 23 Apr 2021 22:24:47 +0000 (15:24 -0700)]
nfsd: fix session slot handling for failed callbacks

When the NFSv4.1/4.2 server does a callback to a client
on the back channel, it will use a session slot in the
back channel session. If the back channel has failed,
the callback will fail and, without this patch, the
session slot will not be released.
As more callbacks are attempted, all session slots
can become busy and then the nfsd thread gets stuck
waiting for a back channel session slot.

This patch frees the session slot upon callback
failure to avoid this problem.

Without this patch, the problem can be avoided by leaving
delegations disabled in the NFS server.

MFC after: 2 weeks

3 years agoopenssh: add a note about pushing vendor updates
Ed Maste [Fri, 23 Apr 2021 19:35:40 +0000 (15:35 -0400)]
openssh: add a note about pushing vendor updates

Sponsored by: The FreeBSD Foundation

3 years agocxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.
Navdeep Parhar [Fri, 23 Apr 2021 19:17:54 +0000 (12:17 -0700)]
cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agoetcupdate: Remove the old pre-world tree when rotating for -p.
John Baldwin [Fri, 23 Apr 2021 16:40:04 +0000 (09:40 -0700)]
etcupdate: Remove the old pre-world tree when rotating for -p.

This fixes a bug in an earlier change to move tree rotation to
the end of the update where the step to make room for the new
preworld tree was deleting the old "current" tree instead of
the old "preworld" tree.

Reported by: olivier, dhw
Fixes: 0611aec3cf3a373e6a06f103699dbc91c3d6d472
MFC after: 2 weeks

3 years agodtrace tests: Fix tst.system.d after ping/ping6 unification
Mark Johnston [Fri, 23 Apr 2021 14:28:09 +0000 (10:28 -0400)]
dtrace tests: Fix tst.system.d after ping/ping6 unification

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoRe-enable network ioctls in capability mode
Mark Johnston [Fri, 23 Apr 2021 13:14:42 +0000 (09:14 -0400)]
Re-enable network ioctls in capability mode

This reverts a portion of 274579831b61 ("capsicum: Limit socket
operations in capability mode") as at least rtsol and dhcpcd rely on
being able to configure network interfaces while in capability mode.

Reported by: bapt, Greg V
Sponsored by: The FreeBSD Foundation