MFC r263107:

To avoid missing a chance to cancel thread, call _pthread_testcancel at the
beginning of _sem_timedwait.

Submitted by:	Eric van Gyzen &lt; eric at vangyzen dot net &gt;
MFC r262972:
Ignore USB keyboard driver calls from critical sections.
MFC r262676:

All callers of static method load_nvlist() in spa.c handles error case,
so there is no reason to assert that we won't hit an error.  Instead,
just return that error to caller and have the upper layer handle it.

Obtained from:	FreeNAS
Reported by:	rodrigc
Reviewed by:	Matthew Ahrens
MFC r263120:

Pull in r201021 from upstream libc++ trunk:

  Fix for PR18735 - self-assignment for map/multimap gives incorrect
  results in C++03

(Please note: that is an LLVM PR identifier, not a FreeBSD one.)

Reported by:	rakuco
MFC r254302:

  Send a shutdown notification in the driver unload path, to ensure
  notification gets sent in cases where system shuts down with driver
  unloaded.

Sponsored by:	Intel
MFC r254303:

  If a controller fails to initialize, do not notify consumers (nvd) of its
  namespaces.

Sponsored by:	Intel
MFC r259535:
The fasttrap fork handler is responsible for removing tracepoints in the
child process that were inherited from its parent. However, this should
not be done in the case of a vfork, since the fork handler ends up removing
the tracepoints from the shared vm space, and userland DTrace probes in the
parent will no longer fire as a result.

Now the child of a vfork may trigger userland DTrace probes enabled in its
parent, so modify the fasttrap probe handler to handle this case and handle
the child process in the same way that it would handle the traced process.
In particular, if once traces function foo() in a process that vforks, and
the child calls foo(), fasttrap will treat this call as having come from the
parent. This is the behaviour of the upstream code.

While here, add #ifdef guards to some code that isn't present upstream.
MFC r262325:
Print a backtrace if the SDT(9) stub gets called so that there's at least
some hope of figuring out how it happened.
MFC r262754: MFV r253848 (mm):

Update vendor/xz from v5.0 branch to post-5.0.5
MFC r262741:
Do not retry on CAM_FUNC_NOTAVAIL error, but return immediately.
Increment fi_wgen before awakening threads polling the read socket of a
FIFO.  Previously, a thread sleeping in poll() could be awakened and
re-poll the FIFO with the old value of fi_wgen (and thus improperly
setting POLLINIGNEOF) before a thread closing a writable fifo descriptor
bumped fi_wgen.  The end result was that the reading thread in poll()
would never see POLLHUP but could block forever (or until a timeout).

This is a direct commit to 8 and 9 since the FIFO code is implemented
differently in 10.x and later.  The pipe-backed FIFOs in 10 do not have
this bug.
MFC r249559:

Don't leak lock when returning.

PR:	 kern/177888
Submitted by:	Sven-Thorsten Dietrich <sven vyatta com>
MFC r249562:

Fix incomplete printf.

PR:		kern/177889
Submitted by:	Sven-Thorsten Dietrich <sven vyatta com>
MFC r263021:

  Support Last-Modified behind proxies which return UTC instead of GMT.
MFC r257847, r260243: Update aacraid to version 3.2.5.

Approved by:	emaste (co-mentor)
Merge r262690 from head to stable/9:

  When querying a process's umask via sysctl in libprocstat(), don't
  print a warning if EPERM is returned as this is an expected failure
  mode rather than error -- similar to current handling of ESRCH.
  This makes the output of 'procstat -as' vastly more palatable.

  Sponsored by: DARPA, AFRL
MFC r263079:
The auio structure is only initialized when the vnode is symlink,
avoid reading from it otherwise.
MFC r263080:
Use correct types for sizeof() in the calculations for the malloc(9) sizes.
MFC r263095:
Initialize paddr to handle the case of zero size.
Make it possible to call  VOP_PUTPAGES with shared vnode lock instead
of insisting an exclusive lock.

When VFS_LOCK_DEBUG is enabled and when the underlying file system is
capable of MNT_SHARED_WRITES,  a failed assertion may lead to a panic
because when calling fsync(2),  a.k.a.  sys_fsync() over a vnode with
mmap'ed page,  it will grab a shared lock when underlying file system
is capable,  then call vm_object_page_clean that eventually proceeded
to  vnode_pager_putpages()   that  tries  to do  VOP_PUTPAGES,  where
VOP_PUTPAGES_APV  generated from the declaration asserts the vnode is
always exclusively locked by caller.

This is a direct commit to stable/9 because a majority portion of the
original changeset 257899 (kib), which main goal was an optimization,
was omitted.   We saw the panic independently in a FreeNAS bug ticket
(#4578).