Explicitly disable the build of tests when building bmake.

During "make buildworld", building bmake is (one of) the very first steps
and we should not be building any of its tests.  Conceptually, this is the
right thing to do 1) for build simplicity reasons and 2) because there is
no need to build any tests this early on.

In practice, this fixes tinderbox builds of CURRENT from 9.x when MK_TESTS
is enabled.  This is because bsd.test.mk needs some modern bmake features
not present in 9.x (:tW) and tinderbox is forcing the build to use the
CURRENT share/mk files from the very beginning (see r266617).  By skipping
the build of the tests when still using the host make, we omit the problem.
Arguably, what tinderbox is doing is wrong and needs to be addressed, but
that is a separate issue.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268598 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Invoke the DTrace trap handler before calling trap() on amd64. This matches
the upstream implementation and helps ensure that a trap induced by tracing
fbt::trap:entry is handled without recursively generating another trap.

This makes it possible to run most (but not all) of the DTrace tests under
common/safety/ without triggering a kernel panic.

Submitted by:	Anton Rang <anton.rang@isilon.com> (original version)
Phabric:	D95


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268600 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make bind(2) and connect(2) return EAFNOSUPPORT for AF_UNIX on wrong
address family.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191586 for the
original discussion.

Reviewed by:	terry


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268601 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove code separator lines which do not conform to style(9).

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268605 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Generalize vn_get_ino() to allow filesystems to use custom vnode
producer, instead of hard-coding VFS_VGET().  New function, which
takes callback, is called vn_get_ino_gen(), standard callback for
vn_get_ino() is provided.

Convert inline copies of vn_get_ino() in msdosfs and cd9660 into the
uses of vn_get_ino_gen().

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268606 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
In kern_linkat(), avoid passing doomed vnode to the VOP.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268607 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The tmpfs_link() must not dereference the filesystem-specific data for
a vnode until it is verified that the vnode indeed belongs to tmpfs
mount.  Otherwise, it might access random memory, at least in the
debug kernel.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268608 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add some assertions for the code handling vm_object for tmpfs vnode.
In particular, vnode must be exclusively locked when the tmpfs vnode
and object are divorced.  When the vnode is opened, the object must be
still alive, since only live vnode can be opened, and the tmpfs node
owns a reference on the object.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268609 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add convenience macro to assert tmpfs node lock.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268610 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
In tmpfs_alloc_file(), code after the 'out' label does only 'return
error;'.  Replace goto's with the return.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268611 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Extract the code to put a filesystem into the suspended state (at the
unmount time) in the helper vfs_write_suspend_umnt().  Use it instead
of two inline copies in FFS.

Fix the bug in the FFS unmount, when suspension failed, the ufs
extattrs were not reinitialized.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268612 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Style.  Add comment about lock mode.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268613 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use tmpfs_vn_get_ino_gen() to handle the races with reclaim in tmpfs
dotdot lookup.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268614 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The OBJ_TMPFS flag of vm_object means that there is unreclaimed tmpfs
vnode for the tmpfs node owning this object.  The flag is currently
used for two purposes.  First, it allows to correctly handle VV_TEXT
for tmpfs vnode when the ref count on the object is decremented to 1,
similar to vnode_pager_dealloc() for regular filesystems.  Second, it
prevents some operations, which are done on OBJT_SWAP vm objects
backing user anonymous memory, but are incorrect for the object owned
by tmpfs node.

The second kind of use of the OBJ_TMPFS flag is incorrect, since the
vnode might be reclaimed, which clears the flag, but vm object
operations must still be disallowed.

Introduce one more flag, OBJ_TMPFS_NODE, which is permanently set on
the object for VREG tmpfs node, and used instead of OBJ_TMPFS to test
whether vm object collapse and similar actions should be disabled.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268615 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Change forgotten in r268615.  Set the OBJ_TMPFS_NODE flag for
vm_object of VREG tmpfs node.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268616 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rework the tmpfs unmount.

- Suspend filesystem for unmount.  This prevents new tmpfs nodes from
  instantiating, and also ensures that only unmount thread can destroy
  nodes.

- Do not start tmpfs node deletion until all vnodes are reclaimed,
  which guarantees that no thread can access tmpfs data.  For this,
  call vflush() in the loop, until the mnt_nvnodelistsize is non-zero.
  Note that after mnt_nvnodelistsize becomes 0, insmntque() blocks
  insertion of a vnode germ into the mount list of vnodes.

- Fail node allocation when the filesystem is being unmounted.  This
  is race-free due to the vflush() call in loop.  This is mostly
  cosmetic, avoiding some more work which might be done until
  suspension in unmount is started.

Note that there is currently no way to prevent new vnode instantiation
from readers during the unmount.  Due to this, forced unmount might
live-lock if vflush() loop cannot get to the zero vnode count due to
races with readers.  The unmount would proceed after the load is
lifted.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268617 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Unbreak the build by re-enabling exceptions.

Disabling them breaks build on archs using GCC. The problem is at line 156 of
bits/basic_ios.h:

	if (this->exceptions() & __state)
		__throw_exception_again;

With exceptions disabled __throw_exception_again is defined as

#define __throw_exception_again

at line 45 of exception_defines.h and the code results in an empty loop body,
which fails because of -Werror.

Approved by:	cognet


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268619 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make generation of nslexer.c more robust.

Ensure that lex errors fail the build instead of being silently ignored
due to the piped call.  Also postpone the update of the nslexer.c file
until we are sure we have generated it properly.

These changes fix some very obscure build failures I encountered while
building FreeBSD within a chroot that did not have devfs mounted. The
specific errors looked like:

.../libc.so.7: undefined reference to `_nsyyerror'
.../libc.so.7: undefined reference to `_nsyyin'
.../libc.so.7: undefined reference to `_nsyylex'
.../libc.so.7: undefined reference to `_nsyylineno'
.../libc.so.7: undefined reference to `_nsyytext'

and were caused due to a mangled nslexer.c being linked into libc.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268620 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't report non-native block-size pools under zpool status -x

zpool status -x is used to identify pools that are exhibiting
errors or are otherwise unavailable, therefore non-native
block-size pools shouldn't be reported.

Also update man page to clarify other additional conditions
which won't cause a pool to be displayed under zpool status -x.

Sponsored by:	Multiplay


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268621 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Eliminate dead code.  There is no direct map.  This code was cut-and-pasted
from amd64.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@268623 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f