opnsense-src/sys
Warner Losh d78d04b17c cam: Fail the disk if READ CAPACITY returns 4/2 asc/ascq
HGST disks that are sick are returning 44/0 for START UNIT (which we
ignore) and then 4/2 on READ CAPACITY. START UNIT should be enough for
READ CAPACITY to succeed or UNIT ATTENTION. However, we get NOT_READ +
4/2 back. I've seen this on several models of HGST drives. Invalidate
the peripheral when we detect this condition. This is likely the least
bad thing we can do: It removes access to daX, but leaves passY so logs
may be extracted (if awkwardly). Removing daX access removes the disk
device that causes problems to geom outlined below.

Although the timeout is 5s for READ_CAPACITY, we wait the full 30s for
READ_CAPACITY_16. This causes us to stall booting as we start to taste
as soon as we release the final hold... but the tasting means
g_wait_idle() takes now takes over 5 minutes to clear since we do this
for all the opens. Even using a timeout of 3s instead of 30s leads to
boot times of almost 5 minutes in these cases, so there are other,
downstream operations that are taking a while, so it's not just a matter
of adjusting the timeout. Failing the periph early solves the bulk of
this problem (the tasting related delays). What the HBA does is HBA
specific and some have firmwares that are also confused by this when
they enumerate or discover the drive, leading to long (but still shorter
than 5 minute) delays. This patch won't solve that aspect of startup
delays with sick disks.

Perhaps we should fail the periph when START UNIT fails with the same
codes we check in the read capacity path. I'm reluctant to do such a
global change since it's in cam_periph, and there seems no good way to
flag that we want this behavior. It's also a bit magical when it runs
(some drive report 44/0 always, and some just report it on START UNIT,
and these HGST drive fall into the latter category).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D51218
2025-07-10 10:17:01 -06:00
..
amd64 amd64: move efi_map_regs definition 2025-07-07 07:07:15 +03:00
arm riscv: enable allwinner RTC 2025-07-04 12:55:55 -03:00
arm64 linux: Regenerate system call definitions 2025-07-04 14:42:34 +00:00
bsm vfs: Initial revision of inotify 2025-07-04 14:42:33 +00:00
cam cam: Fail the disk if READ CAPACITY returns 4/2 asc/ascq 2025-07-10 10:17:01 -06:00
cddl machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
compat Regen. 2025-07-07 00:20:45 +03:00
conf files: add new IPFILTER_C rule for netpfil/ipfilter sources 2025-07-07 20:03:33 -07:00
contrib iwlwifi: compile in ACPI support 2025-07-04 05:22:22 +00:00
crypto newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
ddb machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
dev mlx5en: add driver tls status string method for rx sessions 2025-07-10 17:42:27 +03:00
dts dts: fix RT-AC58U to match the updated device tree name/alias changes. 2025-04-07 20:45:40 -07:00
fs nfsv4: No need to check va_flags twice. 2025-07-10 16:54:41 +02:00
gdb thread: Remove kernel stack swapping support, part 4 2024-07-29 01:40:22 +00:00
geom machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
gnu bwn(4): BWN_GPL_PHY: make compile again 2025-06-22 00:19:42 +00:00
i386 linux: Regenerate system call definitions 2025-07-04 14:42:34 +00:00
isa newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
kern inotify: do not call into namei() with a locked vnode 2025-07-10 17:34:45 +03:00
kgssapi crypto: Remove uses of CRYPTO_F_DONE 2025-05-09 00:29:23 +00:00
libkern machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
modules sound: Retire midisynth 2025-07-06 16:08:18 +03:00
net pf: assert that we call pf_addrcpy() with a valid address family 2025-07-09 10:57:50 +02:00
net80211 net80211: update ieee80211_output_seqno_assign() to 802.11-2020 2025-07-08 12:37:03 -07:00
netgraph Internal scheduling priorities: Always use symbolic ones 2025-06-17 22:08:02 -04:00
netinet sysctl net.inet.tcp.ktcplist: properly fill driver status length field 2025-07-10 17:42:27 +03:00
netinet6 counter(9): rate limit periods may be more than 1 second 2025-06-25 19:56:22 +02:00
netipsec machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
netlink machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
netpfil pfsync: count failed state insertions 2025-07-09 17:38:08 +02:00
netsmb sockets: garbage collect SB_NOINTR 2025-02-02 22:38:18 -08:00
nfs
nfsclient
nfsserver
nlm nlm: set vnet(9) context in the NLM syscall 2025-02-01 01:00:26 -08:00
ofed ofed: jiffies is unsigned long 2025-04-29 13:53:40 +00:00
opencrypto newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
powerpc gpio: attach gpiobus when the controller is ready 2025-07-04 16:56:00 +03:00
riscv riscv: add aw_rtc device to config 2025-07-04 13:17:45 -03:00
rpc rpctls_impl.c: Fix handling of socket for daemon failure 2025-06-21 16:49:13 -07:00
security audit: move the wait from the queue length from the commit to alloc 2025-06-18 20:57:49 +03:00
sys VOP_WRITE_POST(): correct condition for knote activation 2025-07-07 16:44:21 +03:00
teken Typo: brig(h)tness 2024-09-11 08:35:46 +00:00
tests epoch_test: Assign different priorities using offset 1 2025-06-17 22:09:36 -04:00
tools vfs: Initial revision of inotify 2025-07-04 14:42:33 +00:00
ufs pathconf: Add a new variable for hidden/system 2025-07-05 16:33:16 -07:00
vm vm_fault: drop never-true busy_sleep test 2025-07-06 15:46:00 -05:00
x86 linux: Add inotify support 2025-07-04 14:42:34 +00:00
xdr xdr: provide x_putmbuf method for xdrmem 2025-02-01 01:00:25 -08:00
xen machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
Makefile sys: Index netlink/ files with the cscope target 2024-07-22 09:50:43 +00:00
README.md

FreeBSD Kernel Source:

This directory contains the source files and build glue that make up the FreeBSD kernel and its modules, including both original and contributed software.

Kernel configuration files are located in the conf/ subdirectory of each architecture. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. LINT is a compile-only configuration used to maximize build coverage and detect regressions.

Documentation:

Source code documentation is maintained in a set of man pages, under section 9. These pages are located in share/man/man9, from the top-level of the src tree. Consult intro(9) for an overview of existing pages.

Some additional high-level documentation of the kernel is maintained in the Architecture Handbook.

Source Roadmap:

Directory Description
amd64 AMD64 (64-bit x86) architecture support
arm 32-bit ARM architecture support
arm64 64-bit ARM (AArch64) architecture support
cam Common Access Method storage subsystem - cam(4) and ctl(4)
cddl CDDL-licensed optional sources such as DTrace
conf kernel build glue
compat Linux compatibility layer, FreeBSD 32-bit compatibility
contrib 3rd-party imported software such as OpenZFS
crypto crypto drivers
ddb interactive kernel debugger - ddb(4)
fs most filesystems, excluding UFS, NFS, and ZFS
dev device drivers and other arch independent code
gdb kernel remote GDB stub - gdb(4)
geom GEOM framework - geom(4)
i386 i386 (32-bit x86) architecture support
kern main part of the kernel
libkern libc-like and other support functions for kernel use
modules kernel module infrastructure
net core networking code
net80211 wireless networking (IEEE 802.11) - net80211(4)
netgraph graph-based networking subsystem - netgraph(4)
netinet IPv4 protocol implementation - inet(4)
netinet6 IPv6 protocol implementation - inet6(4)
netipsec IPsec protocol implementation - ipsec(4)
netpfil packet filters - ipfw(4), pf(4), and ipfilter(4)
opencrypto OpenCrypto framework - crypto(7)
powerpc PowerPC/POWER (32 and 64-bit) architecture support
riscv 64-bit RISC-V architecture support
security security facilities - audit(4) and mac(4)
sys kernel headers
tests kernel unit tests
ufs Unix File System - ffs(4)
vm virtual memory system
x86 code shared by AMD64 and i386 architectures