flush_pagedep_deps() drops the soft updates lock while obtaining the vnode of a newly created directory with get_parent_vp(). The MKDIR_BODY dependency may complete during this interval, invalidating the diradd selected before the lock was dropped. Once the directory's allocdirect is retired, the lookup of its first block by block number in flush_newblk_dep() can find an older dependency for a previous use of the same physical block. The newblk hash is not unique by block number: when ffs_reallocblks() relocates a cluster, the completed allocindirs of the old blocks stay on the indirdep's ir_completehd until the indirect block pointer in the inode is written, while the old blocks are already free and may be allocated to a new directory. flush_newblk_dep() then finds a D_ALLOCINDIR where it expects a D_ALLOCDIRECT and panics with "flush_newblk_dep: Bad newblk". Retain the vnode returned by get_parent_vp(), reacquire the soft updates lock, and restart dependency selection. Use the retained vnode only when the newly selected MKDIR_BODY dependency refers to the same inode. Enter flush_newblk_dep() with the soft updates lock held and pass it the associated diradd. Recheck MKDIR_BODY after every operation that may drop the lock, so that completion during the helper's retry loop cannot result in another lookup of the retired allocation. Keep the vnode handling in flush_pagedep_deps(), which owns the retained vnode and the list of unfinished diradds, and move the dependency selection into flush_pagedep_deps1(). The latter never acquires or releases a vnode: it returns EJUSTRETURN with the inode number when it needs one, or with 0 when the retained vnode must be released first, and every call restarts the selection, so a vnode is only used for a diradd found while it was held. This also merges the two get_parent_vp() call sites. Every restart goes through that return: obtaining or releasing a vnode, and continuing after jwait() or getdirtybuf() had to wait with the softdep lock dropped. The diradds deferred on the unfinished list are put back on the pagedep's list before the lock is dropped for a restart, so that none are kept off it while other threads can run. Assert that flush_newblk_dep() is called with the vnode exclusively locked. This preserves the original newblk dependency ordering and retains the existing assertion for an active MKDIR_BODY dependency that resolves to an unexpected dependency type. PR: 297976 Reviewed by: kib Tested by: pho Sponsored by: Sippy Software, Inc. Differential revision: https://reviews.freebsd.org/D59356
FreeBSD Source:
This is the top level of the FreeBSD source directory.
FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.
For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.
The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.
For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.
For official FreeBSD bootable images, see the release page.
Source Roadmap:
| Directory | Description |
|---|---|
| bin | System/user commands. |
| cddl | Source code for third-party software under the Common Development and Distribution License. |
| contrib | Source code for third-party software. |
| crypto | Source code for cryptographic libraries and commands (see crypto/README). |
| etc | Template files for /etc. |
| include | System include files. |
| kerberos5 | Build system for Kerberos 5 (Heimdal). |
| krb5 | Build system for Kerberos 5 (MIT). |
| lib | System libraries. |
| libexec | System commands intended to be executed by other commands or daemons. |
| packages | Base system packages. |
| release | Makefiles and scripts used for building releases and VM images. |
| rescue | Build system for statically linked /rescue commands. |
| sbin | System commands. |
| secure | Build system for cryptographic libraries and commands (excluding Kerberos). |
| share | Shared resources. |
| stand | Boot loader sources. |
| sys | Kernel sources (see sys/README.md). |
| targets | Support for experimental DIRDEPS_BUILD |
| tests | Tests which can be run by Kyua. See tests/README for additional information. |
| tools | Ancillary utilities and tests (not included in the build). |
| usr.bin | User commands. |
| usr.sbin | System administration commands. |
For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.