MFC change 254389:

There are some slight differences from the version in FreeBSD/head.
__FreeBSD_version has been bumped to 902503 for the availability
of the SI_UNMAPPED cdev flag, and the D_UNMAPPED_IO cdevsw flag
remains in place.  D_UNMAPPED_IO no longer does anything.  Drivers that
use that flag will just wind up having mapped I/O by default.  The
impact will only be on performance, not functionality.

  Change the way that unmapped I/O capability is advertised.

  The previous method was to set the D_UNMAPPED_IO flag in the cdevsw
  for the driver.  The problem with this is that in many cases (e.g.
  sa(4)) there may be some instances of the driver that can handle
  unmapped I/O and some that can't.  The isp(4) driver can handle
  unmapped I/O, but the esp(4) driver currently cannot.  The cdevsw
  is shared among all driver instances.

  So instead of setting a flag on the cdevsw, set a flag on the cdev.
  This allows drivers to indicate support for unmapped I/O on a
  per-instance basis.

  sys/conf.h:	Remove the D_UNMAPPED_IO cdevsw flag and replace it
  		with an SI_UNMAPPED cdev flag.

  kern_physio.c:	Look at the cdev SI_UNMAPPED flag to determine
  		whether or not a particular driver can handle
  		unmapped I/O.

  geom_dev.c:	Set the SI_UNMAPPED flag for all GEOM cdevs.
  		Since GEOM will create a temporary mapping when
  		needed, setting SI_UNMAPPED unconditionally will
  		work.

  		Remove the D_UNMAPPED_IO flag.

  nvme_ns.c:	Set the SI_UNMAPPED flag on cdevs created here
  		if NVME_UNMAPPED_BIO_SUPPORT is enabled.

  vfs_aio.c:	In aio_qphysio(), check the SI_UNMAPPED flag on a
  		cdev instead of the D_UNMAPPED_IO flag on the cdevsw.

  sys/param.h:	Bump __FreeBSD_version to 1000045 for the switch from
  		setting the D_UNMAPPED_IO flag in the cdevsw to setting
  		SI_UNMAPPED in the cdev.

  Reviewed by:	kib, jimharris
  Sponsored by:	Spectra Logic
MFC 254416:

  ------------------------------------------------------------------------
  r254416 | ken | 2013-08-16 10:14:32 -0600 (Fri, 16 Aug 2013) | 24 lines

  Add unmapped I/O and larger I/O support to the sa(4) driver.

  We now pay attention to the maxio field in the XPT_PATH_INQ CCB,
  and if it is set, propagate it up to physio via the si_iosize_max
  field in the cdev structure.

  We also now pay attention to the PIM_UNMAPPED capability bit in the
  XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the
  underlying SIM supports unmapped I/O.

  scsi_sa.c:	Add unmapped I/O support and propagate the SIM's
  		maximum I/O size up.

  		Adjust scsi_tape_read_write() in the same way that
  		scsi_read_write() was changed to support unmapped
  		I/O.  We overload the readop parameter with bits
  		that tell us whether it's an unmapped I/O, and we
  		need to set the CAM_DATA_BIO CCB flag.  This change
  		should be backwards compatible in source and
  		binary forms.

  Sponsored by:	Spectra Logic
MFC r251587 (by marcel):
  Remove stub implementation.

MFC r251588 (by marcel):
  Change the set and unset ctlreqs by making the index argument optional.
  This allows setting attributes on tables. One simply does not provide
  an index in that case. Otherwise the entry corresponding the index has
  the attribute set or unset.

  Use this change to fix a relatively longstanding bug in our GPT scheme
  that's the result of rev 198097 (relatively harmless) followed by rev
  237057 (damaging). The damaging part being that our GPT scheme always
  has the active flag set on the PMBR slice. This is in violation with
  EFI. Existing EFI implementions for both x86 and ia64 reject the GPT.
  As such, GPT disks created by us aren't usable under EFI because of
  that.

  After this change, GPT disks never have the active flag set on the PMBR
  slice. In order to make the GPT disk bootable under some x86 BIOSes,
  the reason of rev 198097, one must now set the active attribute on the
  gpt table. The kernel will apply this to the PMBR slice For (S)ATA:
  	gpart set -a active ada0

  To fix an existing GPT disk that has the active flag set in the PMBR,
  and that does not need the flag, use (again for (S)ATA):
  	gpart unset -a active ada0

  The EBR, MBR & PC98 schemes, which also impement at least 1 attribute,
  now check to make sure the entry passed is valid. They do not have
  attributes that apply to the table.
MFC r253910: Add a tunable for the default timeout.

Requested by: rodrigc@, delphij@
MFC r254335: sh: Allow a lone redirection before '|', ';;' or ';&'.

Example: </dev/null | :

PR:		181240
MFC r254231: fnmatch(): Add test for r254353 (pattern with single backslash)

This test cannot be converted to an sh(1) test because the syntax would be
invalid.

r254091 was merged to stable/9 as r254353.

PR:		181129
MFC of 253973:

To better understand performance problems with journalled soft updates,
we need to collect the highest level of allocation for each of the
different soft update dependency structures. This change collects these
statistics and makes them available using `sysctl debug.softdep.highuse'.

Reviewed by: kib
Tested by:   Peter Holm

MFC of 253974:

With the addition of journalled soft updates, the "newblk" structures
persist much longer than previously. Historically we had at most 100
entries; now the count may reach a million. With the increased count
we spent far too much time looking them up in the grossly undersized
newblk hash table. Configure the newblk hash table to accurately reflect
the number of entries that it must index.

Reviewed by: kib
Tested by:   Peter Holm
MFC after:   2 weeks
MFC of 253998:

This bug fix is in a code path in rename taken when there is a
collision between a rename and an open system call for the same
target file. Here, rename releases its vnode references, waits for
the open to finish, and then restarts by reacquiring its needed
vnode locks. In this case, rename was unlocking but failing to
release its reference to one of its held vnodes. The effect was
that even after all the actual references to the vnode had gone,
the vnode still showed active references. For files that had been
removed, their space was not reclaimed until the filesystem was
forcibly unmounted.

This bug manifested itself in the Postgres server which would
leak/lose hundreds of files per day amounting to many gigabytes of
disk space. This bug required shutting down Postgres, forcibly
unmounting its filesystem, remounting its filesystem and restarting
Postgres every few days to recover the lost space.

Reported by: Dan Thomas and Palle Girgensohn
Bug-fix by:  kib
Tested by:   Dan Thomas and Palle Girgensohn
MFC r254945:
When allocating a pbuf for the cluster write, do not sleep waiting
for the available pbuf when passed vnode is backing md(4). Other i/o
directed to the same md device might already hold pbufs, and then we
could deadlock since only our progress can free a pbuf needed for
wakeup.
Add read-only support for extents in ext2fs.

Basic support for extents was implemented by Zheng Liu as part
of his Google Summer of Code in 2010. This support is read-only
at this time.

In addition to extents we also support the huge_file extension
for read-only purposes. This works nicely with the additional
support for birthtime/nanosec timestamps and dir_index that
have been added lately.

The implementation may not work for all ext4 filesystems as
it doesn't support some features that are being enabled by
default on recent linux like flex_bg. Nevertheless, the feature
should be very useful for migration or simple access in
filesystems that have been converted from ext2/3 or don't use
incompatible features.

Special thanks to Zheng Liu for his dedication and continued
work to support ext2 in FreeBSD.

Submitted by:	Zheng Liu (lz@)
Reviewed by:	Mike Ma, Christoph Mallon (previous version)
Sponsored by:	Google Inc.
Add read-only support for extents in ext2fs.

Basic support for extents was implemented by Zheng Liu as part
of his Google Summer of Code in 2010. This support is read-only
at this time.

In addition to extents we also support the huge_file extension
for read-only purposes. This works nicely with the additional
support for birthtime/nanosec timestamps and dir_index that
have been added lately.

The implementation may not work for all ext4 filesystems as
it doesn't support some features that are being enabled by
default on recent linux like flex_bg. Nevertheless, the feature
should be very useful for migration or simple access in
filesystems that have been converted from ext2/3 or don't use
incompatible features.

Special thanks to Zheng Liu for his dedication and continued
work to support ext2 in FreeBSD.

Submitted by:	Zheng Liu (lz@)
Reviewed by:	Mike Ma, Christoph Mallon (previous version)
Sponsored by:	Google Inc.
MFC r254018:
Pass variables prefixed with both LD_ and LD_32_ to the run-time linker.
This prevents unintentional execution of programs when running ldd(1) on
32-bit Linux binaries.
MFC r255056
  Reduce WARNS to 0 for dig, host, and nslookup to make them
  compile with the optional WITH_BIND_SIGCHASE.

  Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>
  Approved by:  delphij (mentor, implicit)
  Sponsored by: DK Hostmaster A/S
MFC	r254326:

Add support for the GCC binary integer constants extension.

This is required to build the i965 backend with newer versions of mesa.

Original patch from Joerg Wunsch in GCC Bug 23479, under the GPLv2;
also taken from there in OpenBSD.

Obtained from:	gcc 4.3 (rev. 125346; GPLv2)
Merge r254809 and r254937 from head:

. Fix the "2step" feature (i.e. 360 KiB floppies in 1200 MiB drives)
. Fix the FDOPT_NOERROR option
Partial MFC of r248534: Implement SOCK_CLOEXEC and SOCK_NONBLOCK in kernel.

SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and socketpair()'s
type parameter.

The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD.

The SOCK_* flags are not passed to MAC because this may cause incorrect
failures and can be done later via fcntl() anyway. On the other hand, audit
is expected to cope with the new flags.

This commit does not add the constants to <sys/socket.h> as in r248534
because this would lead to various newly compiled software not working on
old kernels. It only serves to help 10.x binaries and prepare for a possible
full MFC (if third-party software starts to insist on SOCK_CLOEXEC and
SOCK_NONBLOCK).

MSG_CMSG_CLOEXEC from r248534 is not merged here because it changes a
KPI/KBI.

No mergeinfo because the rest of r248534 is missing.
MFC r245428:

Add CLOCK_PROCESS_CPUTIME_ID to <time.h>, to synchronize the CLOCK_*
values with those in <sys/time.h>.  Otherwise, if a program includes
<time.h> before <sys/time.h>, the CLOCK_PROCESS_CPUTIME_ID macro never
gets defined.

Reviewed by:	davidxu
MFC r255090 and r255128:

PR:		kern/181728
MFH (r254684, r254955): fix segfault on reload.
MFH (r255156): silence an error message on non-IPv6 interfaces.
MFH (r255243): create /var/authpf with correct ownership and permissions.