Remove support for the IPX and NCP protocols, and for NWFS. This was on the list for a longer time now. FreeBSD removed it recently, too. Their commit msg has some more info: "IPX was a network transport protocol in Novell's NetWare network operating system from late 80s and then 90s. The NetWare itself switched to TCP/IP as default transport in 1998. Later, in this century the Novell Open Enterprise Server became successor of Novell NetWare. The last release that claimed to still support IPX was OES 2 in 2007. Routing equipment vendors (e.g. Cisco) discontinued support for IPX in 2011." The commit removes support for NCP (NetWare Core Protocol) and NWFS (NetWare File System) along with it (both gone from FreeBSD too since a while).
kernel - Rewrite vnode ref-counting code to improve performance * Rewrite the vnode ref-counting code and modify operation to not immediately VOP_INACTIVE a vnode when its refs drops to 0. By doing so we avoid cycling vnodes through exclusive locks when temporarily accessing them (such as in a path lookup). Shared locks can be used throughout. * Track active/inactive vnodes a bit differently, keep track of the number of vnodes that are still active but have zero refs, and rewrite the vnode freeing code to use the new statistics to deactivate cached vnodes.
kernel - remove bounds on buffer cache nbuf count for 64-bit * Remove arbitrary 1GB buffer cache limitation * Adjusted numerous 'int' fields to 'long'. Even though nbuf is not likely to exceed 2 billion buffers, byte calculations using the variable began overflowing so just convert that and various other variables to long. * Make sure we don't blow-out the temporary valloc() space in early boot due to nbufs being too large. * Unbound 'kern.nbuf' specifications in /boot/loader.conf as well.
kernel/nwfs: The NCP check only applies if it is not the module build. Add some dependency stuff that will cause nwfs to load ncp if it is not loaded or in the kernel. However ncp ultimately depends on IPX which is not available as a module, so that's the minimum that needs compiling into the kernel in order to use nwfs. This should really fix the kernel build.
kernel: Add missing MODULE_VERSION()s for file systems. The loader will figure out by itself whether to load a module or not, depending on whether it's already in the kernel config or not, iif MODULE_VERSION() is present. I.e., if MSDOSFS (that has MODULE_VERSION()) is in the config and msdos_load="YES" is in /boot/loader.conf, msdos.ko will not be loaded by the loader at all. Without MODULE_VERSION() it will lead (in the best case) to whining in dmesg like for ahci or (in the worst case) to weird behavior, such as for nullfs: # mount -a null: vfsload(null): No such file or directory Therefore, we definitely want MODULE_VERSION() for all new modules. This commit is the first in a series to add the missing MODULE_VERSION()s. I know that ufs is not a module, just included it for completeness' sake. Reported-by: marino, tuxillo
kernel - Do a better job with the filesystem background sync * Adjust code for MNT_LAZY, MNT_NOWAIT, and MNT_WAITOK to reflect the fact that they are three different flags and not enumeration constants. * HAMMER now sets VMSC_ONEPASS for MNT_LAZY syncs (background filesystem sync). This generally reduces instances where the background sync winds up running continuously when heavy filesystem ops saturate the disk. Fewer vnodes dirtied after the sync is initiated will get caught up in the sync.
kernel - fine-grained namecache and partial vnode MPSAFE work Namecache subsystem * All vnode->v_flag modifications now use vsetflags() and vclrflags(). Because some flags are set and cleared by vhold()/vdrop() which do not require any locks to be held, all modifications must use atomic ops. * Clean up and revamp the namecache MPSAFE work. Namecache operations now use a fine-grained MPSAFE locking model which loosely follows these rules: - lock ordering is child to parent. e.g. lock file, then lock parent directory. This allows resolver recursions up the parent directory chain. - Downward-traversing namecache invalidations and path lookups will unlock the parent (but leave it referenced) before attempting to lock the child. - Namecache hash table lookups utilize a per-bucket spinlock. - vnode locks may be acquired while holding namecache locks but not vise-versa. VNodes are not destroyed until all namecache references go away, but can enter reclamation. Namecache lookups detect the case and re-resolve to overcome the race. Namecache entries are not destroyed while referenced. * Remove vfs_token, the namecache MPSAFE model is now totally fine-grained. * Revamp namecache locking primitves (cache_lock/cache_unlock and friends). Use atomic ops and nc_exlocks instead of nc_locktd and build-in a request flag. This solves busy/tsleep races between lock holder and lock requester. * Revamp namecache parent/child linkages. Instead of using vfs_token to lock such operations we simply lock both child and parent namecache entries. Hash table operations are also fully integrated with the parent/child linking operations. * The vnode->v_namecache list is locked via vnode->v_spinlock, which is actually vnode->v_lock.lk_spinlock. * Revamp cache_vref() and cache_vget(). The passed namecache entry must be referenced and locked. Internals are simplified. * Fix a deadlock by moving the call to _cache_hysteresis() to a place where the current thread otherwise does not hold any locked ncp's. * Revamp nlookup() to follow the new namecache locking rules. * Fix a number of places, e.g. in vfs/nfs/nfs_subs.c, where ncp->nc_parent or ncp->nc_vp was being accessed with an unlocked ncp. nc_parent and nc_vp accesses are only valid if the ncp is locked. * Add the vfs.cache_mpsafe sysctl, which defaults to 0. This may be set to 1 to enable MPSAFE namecache operations for [l,f]stat() and open() system calls (for the moment). VFS/VNODE subsystem * Use a global spinlock for now called vfs_spin to manage vnode_free_list. Use vnode->v_spinlock (and vfs_spin) to manage vhold/vdrop ops and to interlock v_auxrefs tests against vnode terminations. * Integrate per-mount mnt_token and (for now) the MP lock into VOP_*() and VFS_*() operations. This allows the MP lock to be shifted further inward from the system calls, but we don't do it quite yet. * HAMMER: VOP_GETATTR, VOP_READ, and VOP_INACTIVE are now MPSAFE. The corresponding sysctls have been removed. * FIFOFS: Needed some MPSAFE work in order to allow HAMMER to make things MPSAFE above, since HAMMER forwards vops for in-filesystem fifos to fifofs. * Add some debugging kprintf()s when certain MP races are averted, for testing only. MISC * Add some assertions to the VM system. * Document existing and newly MPSAFE code.
Use SYSREF to reference count struct vnode. v_usecount is now v_sysref(.refcnt). v_holdcnt is now v_auxrefs. SYSREF's termination state (using a negative reference count from -0x40000000+) now places the vnode in a VCACHED or VFREE state and deactivates it. The vnode is now assigned a 64 bit unique id via SYSREF. vhold() (which manipulates v_auxrefs) no longer reactivates a vnode and is explicitly used only to track references from auxillary structures and references to prevent premature destruction of the vnode. vdrop() will now only move a vnode from VCACHED to VFREE on the 1->0 transition of v_auxrefs if the vnode is in a termination state. vref() will now panic if used on a vnode in a termination state. vget() must now be used to explicitly reactivate a vnode. These requirements existed before but are now explicitly asserted. vlrureclaim() and allocvnode() should now interact a bit better. In particular, vlrureclaim() will do a better job of finding vnodes to flush and transition from VCACHED to VFREE, and allocvnode() will do a better job finding vnodes to reuse without getting blocked by a flush. allocvnode now uses a real VX lock to sequence vnodes into VRECLAIMED. All vnode special state processing now uses a VX lock. Vnodes are now able to be slowly returned to the memory pool when kern.maxvnodes is reduced at run time. Various initialization elements have been moved to CTOR/DTOR and are no longer in the critical path, improving performance. However, since SYSREF uses atomic_cmpset_int() (aka cmpxchgl), which reduces performance somewhat, overall performance tends to be about the same.
VNode sequencing and locking - part 3/4. VNode aliasing is handled by the namecache (aka nullfs), so there is no longer a need to have VOP_LOCK, VOP_UNLOCK, or VOP_ISSLOCKED as 'VOP' functions. Both NFS and DEADFS have been using standard locking functions for some time and are no longer special cases. Replace all uses with native calls to vn_lock, vn_unlock, and vn_islocked. We can't have these as VOP functions anyhow because of the introduction of the new SYSLINK transport layer, since vnode locks are primarily used to protect the local vnode structure itself.
Remove several layers in the vnode operations vector init code. Declare the operations vector directly instead of via a descriptor array. Remove most of the recalculation code, it stopped being needed over a year ago. This work is similar to what FreeBSD now does, but was developed along a different line. Ultimately our vop_ops will become SYSLINK ops for userland VFS and clustering support.
Remove the thread argument from all mount->vfs_* function vectors, replacing it with a ucred pointer when applicable. This cleans up a considerable amount of VFS function code that previously delved into the process structure to get the cred, though some code remains. Get rid of the compatibility thread argument for hpfs and nwfs. Our lockmgr calls are now mostly compatible with NetBSD (which doesn't use a thread argument either). Get rid of some complex junk in fdesc_statfs() that nobody uses. Remove the thread argument from dounmount() as well as various other filesystem specific procedures (quota calls primarily) which no longer need it due to the lockmgr, VOP, and VFS cleanups. These cleanups also have the effect of making the VFS code slightly less dependant on the calling thread's context.