MFC r271424,r272579:

    - Add $netif_ipexpand_max to specify the upper limit for the number of
      addresses generated by an address range specification.  The default value
      is 2048.  This can be increased by setting $netif_ipexpand_max in
      rc.conf.
    - Bump .Dd missed in r271424


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272581 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r272349, r272422 and r272479:
- Fix XHCI driver for devices which have more than 15 physical root HUB
  ports. The current bitmap array was too small to hold more than 16
  bits and would at some point toggle the context size, which then would
  trigger an enumeration fault and cause a fallback to the EHCI
  companion controller, if any.
- Make sure we always set the maximum number of valid contexts.
- Set default cycle state in case of early interrupts.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272586 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r272480:
When we fail to get a USB reference we should just return, because
there are no more references held.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272593 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Account for the mapped pages in the kernel_pmap on x86 in
pmap_mapdev().  The pmap_unmapdev() on stable/9 calls pmap_remove() to
clear the range, which decrements kernel_pmap.pm_stats.resident_count.
Misaccounting causes miscellaneous failures, since pmap_remove() tests
the counter for zero and does nothing.

This is direct commit to stable/9, since HEAD and stable/10 use vmem
and do not utilize pmap_remove() etc.

Based on the submission by:	Kohji Okuno <okuno.kohji at jp.panasonic.com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272667 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make external NFS clients know when files have their attributes changed and
avoid cache the file's state indefinitely. The va_filerev is what is sent
to the client as the "change" attribute, the client is periodically fetching
the attributes and without this option the attribute remains as some garbage
value.

Phabric:	D905
Reported by:	Kevin Buhr <buhr@asaurus.net>
Reviewed by:	rmacklem, delphij
Approved by:	delphij
Obtained from:	r272467
Sponsored by:	QNAP Systems Inc.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272677 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r272176:
  Keep list of lagg ports sorted by if_index.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272681 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r261892: zpool.8: fix typo in option description of labelclear command


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272689 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r261893: zfs.8: fix garbled options in a sample zfs send -R command line


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272691 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r261894: move devd rules for zfs events into a separate file

... and fix stale event types


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272694 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r271609: add gptzfsboot.8, zfsboot.8 and zfsloader.8 manual pages


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272697 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r246531: zfs: update comments about zfid_long_t to match the FreeBSD definitions


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272698 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r235978: device_add_child: protect against child device with no
driver but fixed unit number


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

Fix a panic caused by doing "ifconfig -am" while a lagg is being destroyed.
The thread that is destroying the lagg has already set sc->sc_psc=NULL when
the "ifconfig -am" thread gets to lacp_req().  It tries to dereference
sc->sc_psc and panics.  The solution is for lacp_req() to check the value of
sc->sc_psc.  If NULL, harmlessly return an lacp_opreq structure full of
zeros.  Full details in GNATS.

PR:   189003


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

  Remove stray uma_mtx lock/unlock in zone_drain_wait()

  Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not)
  the uma_mtx, but we would attempt to unlock and relock the mutex if we
  had to sleep because the zone was already draining. The M_NOWAIT callers
  may hold the uma_mtx, but we do not sleep in that case.


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

Merge from NetBSD:

PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings
gracefully.  (don't abuse 0 to mean compute string length internally)

PR:		193447
Submitted by:	Conrad Meyer <conrad.meyer@isilon.com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272755 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC	r272273, r272387, r272443, r272533 :

Add strptime(3) support for %U and %W

Add support for the missing POSIX-2001 %U and %W features: the
existing FreeBSD strptime code recognizes both directives and
validates that the week number lies in the permitted range,
but then simply discards the value.

Initial support for the feature was written by Paul Green.
David Carlier added the initial handling of tm_wday/tm_yday.
Major credit goes to Andrey Chernov for detecting much of the
brokenness and rewriting/cleaning most of the code, making it
much more robust.

Tested independently with the strptime test from the GNU C
library.

PR:		137307
Relnotes:	yes

MFC r272441 :

strptime: %s format fix.

Almost never needed in real life because %s is tends to be
only one format spec.
1) Return code of gmtime_r() is checked.
2) All flags are set.

Submitted by:	ache


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

PR:		193447


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272760 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r238273 (by hrs):
  Remove "prefer_source" address selection option.  FreeBSD has had an
  implementation of RFC 3484 for this purpose for a long time and "prefer_source"
  was never implemented actually.  ND6_IFF_PREFER_SOURCE macro is left intact.

MFC r271307:
  Add the ability to set `prefer_source' flag to an IPv6 address.
  It affects the IPv6 source address selection algorithm (RFC 6724)
  and allows override the last rule ("longest matching prefix") for
  choosing among equivalent addresses. The address with `prefer_source'
  will be preferred source address.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272791 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC	r271879:
awk: Use random(3) instead of rand(3)

While none of them is considered even near to cryptographic
level, random(3) is a better random generator than rand(3).

Use random(3) for awk as is done in other systems.

PR:		193147


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@272919 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r272762: Correct scale factor for T terabyte suffix

PR:		194250


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