MFC r245783:

Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited"
logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and could
therefore potentially corrupt the result (although under normal operation,
neither variable should legitmately exceed 32 bits).

[1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html

Submitted by:	jhb


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250140 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r245328:
Freeze device queue before returning errors to CAM.  This is required
for proper error recovery, including keeping original request order.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250142 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r245647 (by kan):
Do not pretend to have autosense data when no such data is available.

Make umass return an error code if SCSI sense retrieval request
has failed. Make sure scsi_error_action honors SF_NO_RETRY and
SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250144 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249846:

When rebooting (exiting) from the BTX loader, make sure to restore the
GDT from the correct segment, otherwise a triple fault would be caused.
In some virtual environments (VMware, VirtualBox, etc) this could lead
to a unhandled error or hang in the guest emulation software.

Thanks to avg and jhb for a few hints in the right direction.

Noticed by:	Jeremy Chadwick <jdc@koitsu.org> (and many others)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250151 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250075:
Properly terminate the result string for intermediate results.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r249548
Allow the vnode to be unlocked for the weird case of
LK_EXCLOTHER. LK_EXCLOTHER is only used to acquire a
usecount on a vnode during NFSv4 recovery from an
expired lease.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250178 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249489,249555

  Run configtest before restarting so that the system is not
  left without a running sshd.

  Also call configtest before reload to ensure working config.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250195 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r233473,233512,233518,233992,233994,238808,238920,250209-250211.

libc/locale: sync mdoc changes with head.

 r233473:
  mdoc: document title should be all caps.

 r233512:
  mdoc: remove empty lines.

 r233518:
  mdoc: remove unknown macro.

 r233992:
  mdoc: fix column names, indentation, column separation within each row, and
  quotation. Also make sure we have the same amount of columns in each row as
  the number of columns we specify in the head arguments.

 r233994:
  mdoc: fix function type.

 r238808:
  Start manpage with Dd macro and also remove a trailing whitespace
  while here.

 r238920:
  Remove trailing whitespace.

 r250209:
  querylocale(3): remove the STANDARDS section.

 r250210,r250211:
  Remove an extra comma, add a missing period.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250213 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r228269,228921:

- libc: Eliminate 13 relative relocations in wctype().
- libc: Eliminate some relative relocations in setlocale().


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250215 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r244091:

Improve style(9) compliance of function declarations.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250216 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250000:
  Move IPPROTO_IPV6 from #ifdef __BSD_VISIBLE to #if __POSIX_VISIBLE >= 201112
  since POSIX 2001 states that it shall be defined.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250228 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249983: syslogd: Use closefrom() instead of getdtablesize()/close()
loop.

When syslogd forks a process for '|' destinations, it closes all file
descriptors greater than 2.

Use closefrom() for this instead of a getdtablesize()/close() loop because
it is both faster and avoids leaving file descriptors open because the limit
was lowered after they were opened.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250232 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r245304 (by theraven):

  Merge new version of libcxxrt.  This brings in three fixes:

  - Don't treat pointers to members as pointers in catch blocks
    (they're usually fat pointers).

  - Correctly catch foreign exceptions in catchalls.

  - Ensure that a happens-before relationship is established when
    setting terminate handlers in one thread and calling them in
    another.

MFC r245327 (by theraven):

  Fix libcxxrt / libc++ build with the clang in head.

  Pointy hat to:	theraven

MFC r245745 (by theraven):

  Import new fix from libcxxrt.  This fixes the case where you attempt
  to rethrow an exception when you haven't caught one.  This is largely
  a cosmetic fix, as (unless you have a very unusual terminate handler
  installed) it will print a nice error and then abort, rather than
  just aborting.

MFC r246462 (by theraven):

  Fix a copy-and-paste error in libcxxrt.

MFC r249993:

  Merge libcxxrt c812a07cd2f95c1403baf0bbe0366e7618d1d6d3:

  * Don't call the _fast version of the TLS accessor in terminate() or
    unexpected().
    1) TLS may not have been set up yet.
    2) When we're in one of these functions, Really Bad Stuff has
       happened and potentially saving a few cycles really isn't
       important.
  * Merge in fixes from FreeBSD trunk to make atomics work with recent
    clang.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248933:

Use a shared lock for VOP_GETEXTATTR, as it is a read-like operation.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250248 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r249623
Both NFS clients can deadlock when using the "rdirplus" mount
option. This can occur when an nfsiod thread that already holds
a buffer lock attempts to acquire a vnode lock on an entry in
the directory (a LOR) when another thread holding the vnode lock
is waiting on an nfsiod thread. This patch avoids the deadlock by disabling
readahead for this case, so the nfsiod threads never do readdirplus.
Since readaheads for directories need the directory offset cookie
from the previous read, they cannot normally happen in parallel.
As such, testing by jhb@ and myself didn't find any performance
degredation when this patch is applied. If there is a case where
this results in a significant performance degradation, mounting
without the "rdirplus" option can be done to re-enable readahead
for directories.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250257 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r249630
When an NFS unmount occurs, once vflush() writes the last dirty
buffer for the last vnode on the mount back to the server, it
returns. At that point, the code continues with the unmount,
including freeing up the nfs specific part of the mount structure.
It is possible that an nfsiod thread will try to check for an
empty I/O queue in the nfs specific part of the mount structure
after it has been free'd by the unmount. This patch avoids this problem by
setting the iodmount entries for the mount back to NULL while holding the
mutex in the unmount and checking the appropriate entry is non-NULL after
acquiring the mutex in the nfsiod thread.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250258 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250026:

Convert panic() into KASSERT().


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250262 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r250028:
Assert that the object type for the vnode' non-NULL v_object, passed
to vnode_pager_setsize(), is either OBJT_VNODE, or, if vnode was
already reclaimed, OBJT_DEAD.

More, if the object is terminated, do not perform the resizing operation.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250263 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge r246619 from head:
  Correct spelling of "daemon".  No .Dd bump.
  Noticed by:   Nathan Rich <Nathan.Rich dynastysystems com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@250277 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge r247915 from head:
  The ZyXEL ZyAIR G-202 is also supported by zyd(4)


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