kernel - Performance tuning (3) * The VOP_CLOSE issues revealed a bigger issue with vn_lock(). Many callers do not check the return code for vn_lock() and in nearly all of those cases it wouldn't fail anyway due to a prior ref, but it creates an API issue. * Add the LK_FAILRECLAIM flag to vn_lock(). This flag explicitly allows vn_lock() to fail if the vnode is undergoing reclamation. This fixes numerous issues, particularly when VOP_CLOSE() is called during a reclaim due to recent LK_UPGRADE's that we do in some VFS *_close() functions. * Remove some unused LK_ defines.
kernel - Major signal path adjustments to fix races, tsleep race fixes, +more * Refactor the signal code to properly hold the lp->lwp_token. In particular the ksignal() and lwp_signotify() paths. * The tsleep() path must also hold lp->lwp_token to properly handle lp->lwp_stat states and interlocks. * Refactor the timeout code in tsleep() to ensure that endtsleep() is only called from the proper context, and fix races between endtsleep() and lwkt_switch(). * Rename proc->p_flag to proc->p_flags * Rename lwp->lwp_flag to lwp->lwp_flags * Add lwp->lwp_mpflags and move flags which require atomic ops (are adjusted when not the current thread) to the new field. * Add td->td_mpflags and move flags which require atomic ops (are adjusted when not the current thread) to the new field. * Add some freeze testing code to the x86-64 trap code (default disabled).
kernel - Make numerous proc accesses use p->p_token instead of proc_token. * pfind() zpfind() now returns a referenced proc structure, callers must release the proc with PRELE(). Callers no longer need to hold proc_token for stable access. * Enhance pgrp, adding pgrp->pg_token and pgrp->pg_refs in addition to pgrp->pg_lock. The lock is used to interlock races between fork() and signals while the token and refs are used to control access. * Add pfindn(), a version of pfind() which does not ref the returned proc. Some code still uses it (linux emulation) ---> needs work. * Add pgref() and pgrel() to mess with the pgrp's pg_refs. pgrel() automatically destroys the pgrp when the last reference goes away. * Most process group operations now use the per-process token instead of proc_token, though pgfind() still needs it temporarily. * pgfind() now returns a referenced pgrp or NULL. * Interlock signal handling with p->p_token instead of proc_token. * Adjust most nice/priority functions to use the per-process token. * Add protective PHOLD()s in various places in the signal code, the ptrace code, and procfs. * Change funsetown() to take the address of the sigio pointer to match fsetown(), add sanity assertions. * pgrp's in tty sessions are now ref-counted.
cache_fullpath - Guess mountpoints if requested * cache_fullpath (and vn_fullpath) now take an extra parameter, guess, which, if != 0, makes cache_fullpath look for a matching mp if an ncp flagged as a mountpoint is found while traversing upwards. This fixes uses of *_fullpath when no nch is provided, but only a vp. * Change all consumers of cache_fullpath and vn_fullpath to accomodate for the extra parameter. Suggested-by: Matthew Dillon
linprocfs - Introduce /proc/mounts * Introudce the /proc/mounts entry to satisfy some installers, and df. * NOTE: if you intend to chroot into the linux base, you'll have to change your /compat/linux/etc/mtab symlink to point to /proc/mounts instead. Also note that the paths are not relative to the linux chroot. Reported-by: Sascha Wildner
linux emulation - Major update * Major update to all components of the linux emulation layer (linuxulator) and linprocfs. * Many old system calls have been overhauled and new ones added. * Tested with java 1.6.18, apache tomcat 6, opera, Acrobat Reader, ... * NOTE: Flash doesn't work yet, and I haven't been able to figure out why. I'll continue my work on the linuxulator part time now, and hopefully eventually fix the issue(s). Some parts of this have been taken from FreeBSD and NetBSD. Overall the new stuff isn't as well organized as it should be; most of the new defines are in linux.h as I didn't bother splitting it up into independent headers. Once we plan on porting the linuxulator to amd64, this has to be taken care of, so especially machine independent bits are broken out of the machine dependent sys/emulation/linux/i386.
Make necessary changes to readdir/getdirentries to support HAMMER. HAMMER needs to use 64 bit directory cookies. Adjust libc's DIR structure and change readdir to acquire the directory position via lseek() instead of using the basep argument to getdirentries(). The basep argument is a long, which is 32 bits on IA32, and it just isn't wide enough. The seek position is 64 bits and is wide enough. Sizeof(DIR) has changed, but hopefully won't cause any major issues since libc is responsible for allocating it. The APIs remain the same. Adjust the VOP_READIR() VFS interface routine to return 64 bit cookies. All VFSs have been reworked, requiring only minor adjustments.
Remove the vpp (returned underlying device vnode) argument from VOP_BMAP(). VOP_BMAP() may now only be used to determine linearity and clusterability of the blocks underlying a filesystem object. The meaning of the returned block number (other then being contiguous as a means of indicating linearity or clusterability) is now up to the VFS. This removes visibility into the device(s) underlying a filesystem from the rest of the kernel.