Commit Graph

277719 Commits

Author SHA1 Message Date
Mark Johnston
09a2fce092 makefs tests: Do not run ZFS tests in parallel
makefs-created pools always have the same GUID and thus cannot be
imported simultaneously.

Reported by:	olivier
2022-08-29 12:54:25 -04:00
Mark Johnston
a3b6b3ac4d makefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined 2022-08-29 12:50:51 -04:00
Mark Johnston
575ca2c265 makefs: Remove some redundant initializations
No functional change intended.
2022-08-29 12:50:51 -04:00
Alexander V. Chernikov
7b3440fc30 Revert "routing: install prefix and loopback routes using new nhop-based KPI."
Temporarily revert the commit to unblock testing.

This reverts commit a1b59379db.
2022-08-29 16:20:42 +00:00
Doug Moore
5d91386826 rb_tree: avoid extra reads in rebalancing
In RB_INSERT_COLOR and RB_REMOVE_COLOR, avoid reading a parent pointer
from memory, and then reading the left-color bit from memory, and then
reading the right-color bit from memory, since they're all in the same
field. The compiler can't infer that only the first read is really
necessary, so write the code in a way so that it doesn't have to.

Drop RB_RED_LEFT and RB_RED_RIGHT macros that reach into memory to get
those bits.  Drop RB_COLOR, the only thing left using RB_RED_LEFT and
RB_RED_RIGHT after the other changes, and go straight to DIAGNOSTIC
code in subr_stats to implement RB_COLOR for its single, dubious use
there.

Reviewed by:	alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36353
2022-08-29 11:11:31 -05:00
Alexander V. Chernikov
578a99c939 routing: improve multiline debug
Add IF_DEBUG_LEVEL() macro to ensure all debug output preparation
 is run only if the current debug level is sufficient. Consistently
 use it within routing subsystem.

MFC after:	2 weeks
2022-08-29 15:14:49 +00:00
Alexander V. Chernikov
fe05d1dd0f routing: extend nhop(9) kpi
* add nhop_get_unlinked() used to prepare referenced but not
 linked nexthop, that can later be used as a clone source.
* add nhop_check_gateway() to check for allowed address family
  combinations between the rib family and neighbor family (useful
  for 4o6 or direct routes)
* add nhop_set_upper_family() to allow copying IPv6 nexthops to
 IPv4 rib.
* add rt_get_rnd() wrapper, returning both nexthop/group and its
 weight attached to the rtentry.
* Add CHT_SLIST_FOREACH_SAFE(), allowing to delete items during
  iteration.

MFC after:	2 weeks
2022-08-29 14:46:03 +00:00
Alexander V. Chernikov
c24a8f19c5 routing: fix rib_add_route_px()
Fix panic in newly-added rib_add_route_px() by removin unlocked
 prefix lookup.

MFC after:	2 weeks
2022-08-29 12:57:47 +00:00
Alexander V. Chernikov
db4ca19002 routing: add ability to store opaque indentifiers in nhops/nhgs
This is a pre-requisite for the direct nexthop/nexhop group operations
 via netlink.

MFC after:	2 weeks
2022-08-29 12:20:28 +00:00
Alexander V. Chernikov
6d4f6e4c70 routing: make rib_add_redirect() use new nhop-based KPI
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36169
2022-08-29 10:23:26 +00:00
Alexander V. Chernikov
835a611e68 routing: make IPv6 defrouter code use new nhop-based KPI.
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36168
2022-08-29 10:08:47 +00:00
Alexander V. Chernikov
d8b2693414 routing: add rib_add_default_route() wrapper
Multiple consumers in the kernel space want to install IPv4 or IPv6
 default route. Provide convenient wrapper to simplify the code
 inside the customers.

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36167
2022-08-29 10:08:24 +00:00
Alexander V. Chernikov
a1b59379db routing: install prefix and loopback routes using new nhop-based KPI.
Construct the desired hexthops directly instead of using the
 "translation" layer in form of filling rt_addrinfo data.
Simplify V_rt_add_addr_allfibs handling by using recently-added
 rib_copy_route() to propagate the routes to the non-primary address
 fibs.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D36166
2022-08-29 10:07:58 +00:00
Kirk McKusick
827622937e Correct calculation of inode location in getnextino cache.
Fix for 345bfec.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:47:17 -07:00
Wei Hu
9e772f203f mana: Fix a couple i386 build errors
Fix a couple i386 build errors

Fixes:	b685df314f
Sponsored by:	Microsoft
2022-08-29 06:35:02 +00:00
Kirk McKusick
9dee5da745 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Further updates based on ways Peter Holm found to corrupt UFS
superblocks in ways that could cause kernel hangs or crashes.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:14:35 -07:00
Kirk McKusick
2e4da012d5 Correct calculation of inode location in getnextino cache.
Fix for 345bfec.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:09:29 -07:00
Wei Hu
b685df314f mana: some code refactoring and export apis for future RDMA driver
- Record the physical address for doorbell page region
  For supporting RDMA device with multiple user contexts with their
  individual doorbell pages, record the start address of doorbell page
  region for use by the RDMA driver to allocate user context doorbell IDs.

- Handle vport sharing between devices
  For outgoing packets, the PF requires the VF to configure the vport with
  corresponding protection domain and doorbell ID for the kernel or user
  context. The vport can't be shared between different contexts.

  Implement the logic to exclusively take over the vport by either the
  Ethernet device or RDMA device.

- Add functions for allocating doorbell page from GDMA
  The RDMA device needs to allocate doorbell pages for each user context.
  Implement those functions and expose them for use by the RDMA driver.

- Export Work Queue functions for use by RDMA driver
  RDMA device may need to create Ethernet device queues for use by Queue
  Pair type RAW. This allows a user-mode context accesses Ethernet hardware
  queues. Export the supporting functions for use by the RDMA driver.

- Define max values for SGL entries
  The number of maximum SGl entries should be computed from the maximum
  WQE size for the intended queue type and the corresponding OOB data
  size. This guarantees the hardware queue can successfully queue requests
  up to the queue depth exposed to the upper layer.

- Define and process GDMA response code GDMA_STATUS_MORE_ENTRIES
   When doing memory registration, the PF may respond with
   GDMA_STATUS_MORE_ENTRIES to indicate a follow request is needed. This is
   not an error and should be processed as expected.

- Define data structures for protection domain and memory registration
  The MANA hardware support protection domain and memory registration for use
  in RDMA environment. Add those definitions and expose them for use by the
  RDMA driver.

MFC after:	2 weeks
Sponsored by:	Microsoft
2022-08-29 05:24:21 +00:00
Rick Macklem
117cea02a4 nfscl: Fix setup of Sequence when all slots marked bad
Commit 40ada74ee1 modified the NFSv4.1/4.2 client so
that it would issue a DestroySession to the server when
all session slots are marked bad.  Once this is done,
the Sequence operation should get a NFSERR_BADSESSION
reply from the server.

Without this patch, the code was setting ND_HASSLOTID
when, in fact, there was no slot marked in use by
nfsv4_sequencelookup().  This would result in the
code freeing a slot not in use.  The effect of this
was minimal, since the session was already destroyed.

This patch fixes the code so that it does not set
ND_HASSLOTID for this case.

MFC after:	2 weeks
2022-08-28 14:36:45 -07:00
Rick Macklem
0685c73cfe nfscl: Add a console message for session recovery
The NFSv4.1/4.2 client does recovery when it receives a
NFSERR_BADSESSION reply from the server.  If the server has
not rebooted, this is often caused by multiple clients using
the same /etc/hostid and, as such, not being recognized as
different clients by the server.

This trivial patch adds a console message to suggest that
client's /etc/hostid's need to be checked for uniqueness.

MFC after:	2 weeks
2022-08-28 14:24:39 -07:00
Poul-Henning Kamp
31937f7e84 USB id of yet another Lenovo USB-C ethernet dongle. 2022-08-28 17:21:38 +00:00
Michael Tuexen
c624b9a549 tcp: fix stats counter for SYN_RCVD state when TCP-FO is used
Reviewed by:		glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36384
2022-08-28 18:45:59 +02:00
Eugene Grosbein
160a2f2cdd rc.conf(5): add <service>_umask to run the service using this value
None of tools working with login classes change umask(1)
and we had no ways to specify non-default umask for a service
not touching its startup script. This change makes in possible.

Some file-sharing services that create new files may benefit from it.

Differential:	https://reviews.freebsd.org/D36309
MFC-after:	3 days
2022-08-28 12:48:58 +07:00
Doug Moore
5886089ecf rb_tree: fine-tune RB_REMOVE
Improve RB_REMOVE by reading the fields of the removed node only once,
and by not writing to the removed node.

Reviewed by:	kib
Discussed with:	markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36288
2022-08-28 00:43:49 -05:00
Rick Macklem
b875d4f5dd nfsd: Update console message for no session found
The NFSv4.1/4.2 server generates a console message that indicates
that there is no session. I was until recently perplexed w.r.t. how
this could occur. It turns out that the common cause is multiple NFS
clients with the same /etc/hostid.

The host uuid is used by the FreeBSD NFSv4.1/4.2 client as a unique
identifier for the client. If multiple clients use the same host uuid,
this indicates to the NFSv4.1/4.2 server that they are the same client
and confusion occurs.

This trivial patch modifies the console message to suggest that the
client's /etc/hostid needs to be checked for uniqueness.

Reviewed by:	asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36377
2022-08-27 18:31:20 -07:00
Rick Macklem
fb29f81758 nfscl: Fix handling of nd_slotid while handling NFSERR_BADSESSION
When the NFSv4.1/4.2 client is handling a server error
of NFSERR_BADSESSION, it retries RPCs with a new session.
Without this patch, the nd_slotid was not being updated
for the new session.

This would result in a bogus console message like
"Wrong session srvslot=X slot=Y" and then it would
free the incorrect slot, often generating a
"freeing free slot!!" console message as well.

This patch fixes the problem.

Note that FreeBSD NFSv4.1/4.2 servers only
generate a NFSERR_BADSESSION error after a reboot
or after a client does a DestroySession operation.

PR:	260011
MFC after:	1 week
2022-08-27 16:03:18 -07:00
Rick Macklem
f2dfe60776 Revert "nfscl: Fix handling of nd_slotid while handling NFSERR_BADSESSION"
Revert this commit, since I now have a better fix to commit.

This reverts commit 8e59ec29e4.
2022-08-27 15:58:23 -07:00
Kristof Provost
6ab80e7275 pf: do not block new Ethernet rules for in-progress transactions
Make Ethernet rule addition behave just like L3 rules, in that we now
allow ongoing transaction to be interrupted, rather than rejecting a new
one.

The result of that is that we can no longer end up in a state where a
transaction failed, but was not rolled back, blocking us from setting
new rules.

It's safe to assume there's no pending epoch callback for cleanup here,
because we've explicitly called it before hitting pf_begin_eth().

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-08-27 22:25:01 +02:00
Mateusz Guzik
2c1ac3d4d4 nat64: fix whitespace damage in callout calls
No functional changes.
2022-08-27 19:06:41 +00:00
Bjoern A. Zeeb
caaa79c3f8 LinuxKPI 802.11: change type of bssid in struct ieee80211_bss_conf
Enabling other driver code found that the bssid in
struct ieee80211_bss_conf is not an array but expected to be
a const pointer (const, != NULL checks).
Adjust accordingly in the header and in the LinuxKPI compat code.
There initialization now needs to be a static array always present
as we need a value before we will have a BSS (node in scan_to_auth)
as the mac80211 driver (*handlers) are expecting the pointer to be
not NULL (copying without checks).
This is a pre-req to enable d3 (CONFIG_PM[_SLEEP]) in the future.

Tested by:	Tomoaki AOKI (junchoon dec.sakura.ne.jp)
Tested by:	Berislav Purgar (bpurgar gmail.com)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-08-27 14:54:02 +00:00
Gordon Bergling
ce99e4fa44 bhnd(4): Correct a typo in a source code comment
- s/in he/in the/

MFC after:	3 days
2022-08-27 12:10:00 +02:00
Hans Petter Selasky
4e2d8cd3e2 usb(4): Quirk for non-compliant USB devices.
Some non-compliant USB devices do not implement the
clear endpoint halt feature. Silently ignore such
failures, when they at least responded correctly
passing up a valid STALL PID packet.

Tested by:	Doug Ambrisko <ambrisko@ambrisko.com>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-08-27 08:52:28 +02:00
Warner Losh
7ed3228323 stand: Document that boot0 uses BIOS
And thus has a limited range of supported baud rates. Also add that
setting BOOT_BOOT0_COMCONSOLE_SPEED=0 will leave it unchanged which
sometimes can give you 115200 if the BIOS initialized things outside of
the normal BIOS baud rates (which many x86 enbedded-targetted boards
do).

Sponsored by:		Netflix
Reviewed by:		emaste, manu (earlier versions)
Suggestions by:		jhb
Differential Revision:	https://reviews.freebsd.org/D36300
2022-08-26 22:17:56 -06:00
Warner Losh
df065f699f stand: More sensible defaults when ConOut is missing
When ConOut is missing, we used to default to serial. Except we did it
in the worst way possible by just setting the howto bits and not
updating the console setting, which lead to weird behavior where we'd
get some things on the video port, others on serial.

Instead, set console to "efi,comconsole" for this case. Also set
RB_MULTIPLE always (so we get dual consoles from the kernel) and or in
RB_SERIAL when we can't find GOPs that suggest the precense of a video
console. This will put output in the most places and have a sensible
default for 'primary' console.

Sponsored by:		Netflix
Reviewed by:		emaste, manu
Differential Revision:	https://reviews.freebsd.org/D36299
2022-08-26 22:17:56 -06:00
Brooks Davis
a28f833532 libprocstat: forward declare struct kinfo_proc
This allows libprocstat.h to be included without sys/user.h as
documented in the manpage.
2022-08-26 23:20:32 +01:00
Hans Petter Selasky
0b01a13b8a u3g(4): Add more USB IDs.
Submitted by:	malavon <benny.goemans@gmail.com>
MFC after:	1 week
PR:		263700
Sponsored by:	NVIDIA Networking
2022-08-26 22:02:35 +02:00
John Baldwin
e3885a7893 soo_stat: Ensure error is always initialized.
In kernels without MAC, error is not set for sockets whose protocol
layer does not implement the pr_sense hook.

Reported by:	Jenkins (powerpc kernel builds)
Fixes:		7c04ca1fad sockets: for stat(2) on a socket don't report hiwat as block size
2022-08-26 11:17:55 -07:00
Warner Losh
74704a26bc efi: Create a define for memory descriptor version
For true EFI platforms, the EFI BIOS will return version 1 (since no
other version is defined as of this commit). However, for environments
that wish to create an EFI memory mapping table that aren't actually
EFI, we need to know this. Add EFI_MEMORY_DESCRIPTOR_VERSION for this
constant.

Sponsored by:		Netflix
2022-08-26 11:40:42 -06:00
Gleb Smirnoff
837b7203f0 domains: use struct domain as argument 2022-08-26 10:35:35 -07:00
firk
768f6373eb Fix compat10 semaphore interface race
Wrong has-waiters and missing unconditional _count==0 check may cause
infinite waiting with already non-zero count.
1) properly clear _has_waiters flag when waiting failed to start
2) always check _count before start waiting

PR:	265997
Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36272
2022-08-26 20:34:29 +03:00
Gleb Smirnoff
a358db5603 socket(2): bring documentation up tp date
o Undocument sockets that are no longer supported, or never were.
o Add AF_HYPERV. Note: PF_HYPERV isn't defined, no typo here.
o Point at ip(4) and ip6(4) instead of unwelcoming "not described here".

Reviewed by:		gbe, markj
Differential revision:	https://reviews.freebsd.org/D36284
2022-08-26 08:16:15 -07:00
Gleb Smirnoff
7c04ca1fad sockets: for stat(2) on a socket don't report hiwat as block size
The code appeared in d8392c6c39 with not good explanation.  It is
very unlikely any software in the world needs that.

Differential revision:	https://reviews.freebsd.org/D36283
2022-08-26 08:16:15 -07:00
Baptiste Daroussin
5876499023 tzsetup: remove left overs from libbsddialog conversion
PR:	265954
2022-08-26 11:54:17 +02:00
Kirk McKusick
27c6009e72 Correct diagnostic messages for bad cylinder groups.
Fix for 495b1ba.

Reported by:  Mike Karels
Sponsored by: The FreeBSD Foundation
2022-08-26 00:31:44 -07:00
Kirk McKusick
f0be378a66 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Further updates based on ways Peter Holm found to corrupt UFS
superblocks in ways that could cause kernel hangs or crashes.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-26 00:09:01 -07:00
Kirk McKusick
495b1baac3 Provide better diagnostic messages for bad cylinder groups.
Like the detailed diagnostics produced when a bad superblock
is read, provide similar detailed diagnostics when bad
cylinder groups are read.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-25 23:57:56 -07:00
Rick Macklem
8e59ec29e4 nfscl: Fix handling of nd_slotid while handling NFSERR_BADSESSION
When the NFSv4.1/4.2 client is handling a server error
of NFSERR_BADSESSION, it retries RPCs with a new session.
Without this patch, the nd_slotid was not being updated
for the new session.

This would result in a bogus console message like
"Wrong session srvslot=X slot=Y" and then it would
free the incorrect slot, often generating a
"freeing free slot!!" console message as well.

This patch fixes the problem.

Note that FreeBSD NFSv4.1/4.2 servers only
generate a NFSERR_BADSESSION error after a reboot
or after a client does a DestroySession operation.

PR:	260011
MFC after:	1 week
2022-08-25 20:48:04 -07:00
Rick Macklem
2b612c9d3b nfscl: Fix handling of a bad session slot (NFSv4.1/4.2)
When a session has been marked defunct by the server
sending a NFSERR_BADSESSION reply to the NFSv4.1/4.2
client, nfsv4_sequencelookup() returns NFSERR_BADSESSION
without actually assigning a session slot.
Without this patch, newnfs_request() would erroneously
free slot 0.

This could result in the slot being reused prematurely,
but most likely just generated a "freeing free slot!!"
console message.

This patch fixes the code to not do the erroneous
freeing of the slot for this case.

PR:	260011
MFC after:	1 week
2022-08-25 20:33:31 -07:00
Konstantin Belousov
c1a0ab5ec5 amd64: update comment for casueword/casueword32, mentioning return value 1
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-08-26 02:41:48 +03:00
Martin Matuska
08aba0aec7 zfs: merge openzfs/zfs@a582d5299
Notable upstream pull request merges:
  #13717 Fix zpool status in case of unloaded keys
  #13753 Prevent zevent list from consuming all of kernel memory
  #13767 arcstat: fix -p option
  #13785 Updates for snapshots_changed property

Obtained from:	OpenZFS
OpenZFS commit:	a582d52993
2022-08-26 00:58:56 +02:00