freebsd.git
7 years agoRemove dead code.
cy [Thu, 30 Jun 2016 14:53:46 +0000 (14:53 +0000)]
Remove dead code.

Approved by: re@ (hrs@)
MFC after: 1 week

7 years agoMFV r302264:
mm [Thu, 30 Jun 2016 08:51:50 +0000 (08:51 +0000)]
MFV r302264:

Sync libarchive with vendor, bugfixes for tests:
- fix tests on filesystems without birthtime support, e.g. UFS1 (1)
- vendor issue #729: avoid use of C99 for-scope declarations in
  test_write_format_gnutar_filenames.c

MFC after: 1 week
PR: 204157 (1)
Approved by: re (hrs)

7 years agoThis patch fixes two bugs related to the setting of the I-Bit
tuexen [Thu, 30 Jun 2016 06:06:35 +0000 (06:06 +0000)]
This patch fixes two bugs related to the setting of the I-Bit
for SCTP DATA and I-DATA chunks.
* For fragmented user messages, set the I-Bit only on the last
  fragment.
* When using explicit EOR mode, set the I-Bit on the last
  fragment, whenever SCTP_SACK_IMMEDIATELY was set in snd_flags
  for any of the send() calls.

Approved by: re (hrs)
MFC after: 1 week

7 years agoARM, ARM64: Workaround for buf_ring reordering
wma [Thu, 30 Jun 2016 05:18:37 +0000 (05:18 +0000)]
ARM, ARM64: Workaround for buf_ring reordering

    This patch offers a workaround to buf_ring reordering
    visible on armv7 and armv8. This is supposed to be
    removed once new buf_ring implementation is integrated
    into the tree.

    Obtained from:         Semihalf
    Reviewed by:           alc,emaste
    Differential Revision: https://reviews.freebsd.org/D6986
    Approved by:           re (gjb)

7 years agoARM64: fix DMAP calculation
wma [Thu, 30 Jun 2016 04:58:19 +0000 (04:58 +0000)]
ARM64: fix DMAP calculation

    Use arithmetic operators instead of logical. This fixes
    DMAP ranges calculation for ThunderX Dual Socket.

    Obtained from:         Semihalf
    Sponsored by:          Cavium
    Reviewed by:           zbb
    Differential Revision: https://reviews.freebsd.org/D7023
    Approved by:           re (gjb)

7 years agoMove the ipfw_log_bpf() calls from global module initialisation to
bz [Thu, 30 Jun 2016 01:33:14 +0000 (01:33 +0000)]
Move the ipfw_log_bpf() calls from global module initialisation to
per-VNET initialisation and virtualise the interface cloning to
allow a dedicated ipfw log interface per VNET.

Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

7 years agoRemove unused global variables as well as unused memory
bz [Thu, 30 Jun 2016 01:32:12 +0000 (01:32 +0000)]
Remove unused global variables as well as unused memory
allocations from ipfilter in preparation for VNET support.

Suggested by: cy (see D7000)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoEnable indirect segment I/Os by default in the Xen blkfront driver when
cperciva [Wed, 29 Jun 2016 23:56:24 +0000 (23:56 +0000)]
Enable indirect segment I/Os by default in the Xen blkfront driver when
running on EC2.  Due to improvements in EC2, the performance penalty which
was present on some EC2 instances no longer exists, and enabling this
feature now consistently yields ~20% higher throughput with equal or lower
latency.

Reverts: r286063
Approved by: re (gjb)
MFC after: 2 weeks
Relnotes: Improved disk throughput on EC2

7 years agoFixed FreeBSD/mips MALTA support for QEMU
gonzo [Wed, 29 Jun 2016 23:33:44 +0000 (23:33 +0000)]
Fixed FreeBSD/mips MALTA support for QEMU

Recource management functions in GT PCI controller driver
treated memory/IO resources as KSEG1 addresses, later during
activation these values would be increased by KSEG1 base again
rendering the address invalid and causing "bus error" trap.

Actual logic was converted to use real physical addresses,
so mapping takes place only during activation.

Submitted by: Aleksandr Rybalko <ray@FreeBSD.org>
Approved by: re (gjb)

7 years agoFlush every line when using meta mode and no -j or with -B.
bdrewery [Wed, 29 Jun 2016 22:54:01 +0000 (22:54 +0000)]
Flush every line when using meta mode and no -j or with -B.

Otherwise the output is buffered and it appears that make is stuck on something
long-running.  This problem is not present with -j as it uses different
code that was already flushing.

Discussed with: sjg
Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division

7 years agoWITH_META_MODE: Avoid false-positive error due to missing .meta with build commands.
bdrewery [Wed, 29 Jun 2016 22:39:22 +0000 (22:39 +0000)]
WITH_META_MODE: Avoid false-positive error due to missing .meta with build commands.

Sponsored by: EMC / Isilon Storage Division
Approved by: re (blanket, META_MODE)

7 years ago1.Improve handling around last compressed block of the file, which is
sobomax [Wed, 29 Jun 2016 18:19:05 +0000 (18:19 +0000)]
1.Improve handling around last compressed block of the file, which is
  necessary because CLOOP format lacks explicit EOF or length, so that
  in the presence of padding or when the CLOOP is put onto a larger
  partition upper level provider size may be larger. Bound amount
  of extra data that we might touch to the max length of the compressed
  block and detect zero-padding in the last cluster, which when
  sector is all-zero might cause us to emit bogus I/O error after
  decompression of that fails. To not make code any more complicated
  that it needs to be deal with it in lazy-manner, i.e. when we
  first access that specific cluster.

  This change also fixes stupid mistake in the LZMA code, inherited
  from geom_lzma, which does not share length of the output buffer
  buffer with the decompression routine, so that in the presence
  of corrupted or purposedly tailored data may easily cause heap
  overflow and kernel memory corruption.

  Beef up validation of the CLOOP TOC by checking that lengths of
  all but the last compressed clusters match upper limit set by
  the decompressor and improve some error diagnostic output while
  I am here.

2.Add kern.geom.uzip.attach_to tunable to artifically limit
  attaching uzip to certain devices in the dev tree only.

    For example the following only makes us attaching to the
    GPT labels:

    kern.geom.uzip.attach_to="gpt/*"

3.Add kern.geom.uzip.noattach_to, which does opposite to the (2)
  above, i.e. prevents geom_uzip from tasting / attaching to
  providers matching some pattern. By default we don't attach
  to our own kind, i.e. kern.geom.uzip.noattach_to="*.uzip".
  It saves us quite some CPU cycles, esp on low-end embedded
  systems.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7013

7 years agonet80211: fix LOR/deadlock in ieee80211_ff_node_cleanup().
avos [Wed, 29 Jun 2016 17:25:46 +0000 (17:25 +0000)]
net80211: fix LOR/deadlock in ieee80211_ff_node_cleanup().

Add new lock for stageq (part of ieee80211_superg structure) and
ni_tx_superg (part of ieee80211_node structure);
drop com_lock protection where it is used to protect them.

While here, drop duplicate OPACKETS counter incrementation.

ni_tx_ampdu is not protected with it (however, it is also used without
locking in other places; probably, it requires some other solution
to be thread-safe).

Tested with RTL8188CUS (AP) and RTL8188EU (STA).

NOTE: Since this change breaks KBI, all wireless drivers need to be
recompiled.

Reviewed by: adrian
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6958

7 years agoDon't warn about needing filemon for makeman.
bdrewery [Wed, 29 Jun 2016 16:45:01 +0000 (16:45 +0000)]
Don't warn about needing filemon for makeman.

r287879 wasn't quite enough here since Makefile.inc1 is running
'make -C release -V VERSION' and hitting the warning.

Reported by: lattera
Sponsored by: EMC / Isilon Storage Division
Approved by: re (blanket, META_MODE)

7 years agoCorrect PERSISTENT RESERVE OUT command and populate scsi_cmd->length.
sbruno [Wed, 29 Jun 2016 16:41:37 +0000 (16:41 +0000)]
Correct PERSISTENT RESERVE OUT command and populate scsi_cmd->length.

PR: 202625
Submitted by: niakrisn@gmail.com
Reviewed by: scottl kenm
Approved by: re (gjb)
MFC after: 2 weeks

7 years agoFix fat-fingering: #if AIM should have been #ifdef AIM to avoid failures on
nwhitehorn [Wed, 29 Jun 2016 16:34:56 +0000 (16:34 +0000)]
Fix fat-fingering: #if AIM should have been #ifdef AIM to avoid failures on
Book-E kernels.

Approved by: re (gjb)
Pointy hat to: nwhitehorn

7 years agoDo not rely on firmware having pre-enabled the MMU in a reasonable way for
nwhitehorn [Wed, 29 Jun 2016 14:40:43 +0000 (14:40 +0000)]
Do not rely on firmware having pre-enabled the MMU in a reasonable way for
late boot: enable it explicitly after installing the page tables. If booting
from an FDT, also make sure to escape the firmware's MMU context early
before overwriting firmware page tables.

Approved by: re (gjb)

7 years agolibcxxrt: correct mangled "typeinfo name" symbols in Version.map
emaste [Wed, 29 Jun 2016 11:48:42 +0000 (11:48 +0000)]
libcxxrt: correct mangled "typeinfo name" symbols in Version.map

r260553 added missing C++ typinfos to libcxxrt's version script.
It appears that a number of duplicate mangled symbols were added due to
a cut and paste error. Switch the second instances to _ZTS*,
typeinfo name for *.

Found by lld, which produces an error or warning for duplicate symbols.

Reviewed by: dim
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7011

7 years agoAllow ZFS ARC min / max to be tuned at runtime
smh [Wed, 29 Jun 2016 07:55:45 +0000 (07:55 +0000)]
Allow ZFS ARC min / max to be tuned at runtime

Prior to this change ZFS ARC min / max could only be changed using
boot time tunables, this allows the values to be tuned at runtime
using the sysctls:
* vfs.zfs.arc_max
* vfs.zfs.arc_min

When adjusting ZFS ARC minimum the memory used  will only reduce
to the new minimum given memory pressure.

Reviewed by: allanjude
Approved by: re (gjb)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D5907

7 years agocxgbe(4): Do not bring up an interface when IFCAP_TOE is enabled on it.
np [Wed, 29 Jun 2016 06:55:30 +0000 (06:55 +0000)]
cxgbe(4):  Do not bring up an interface when IFCAP_TOE is enabled on it.
The interface's queues are functional after VI_INIT_DONE (which is short
of interface-up) and that's all that's needed for t4_tom to communicate
with the chip.

Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

7 years agoUSB: Add Garmin FR230 device quirk (broken INQUIRY)
cem [Wed, 29 Jun 2016 06:42:20 +0000 (06:42 +0000)]
USB: Add Garmin FR230 device quirk (broken INQUIRY)

PR: 210544
Reviewed by: hps
Approved by: re

7 years agoSeveral device drivers call if_alloc() and then do further checks and
bz [Wed, 29 Jun 2016 05:21:25 +0000 (05:21 +0000)]
Several device drivers call if_alloc() and then do further checks and
will cal if_free() in case of conflict, error, ..
if_free() however sets the VNET instance from the ifp->if_vnet which
was not yet initialized but would only in if_attach(). Fix this by
setting the curvnet from where we allocate the interface in if_alloc().
if_attach() will later overwrite this as needed. We do not set the home_vnet
early on as we only want to prevent the if_free() panic but not change any
of the other housekeeping, e.g., triggered through ifioctl()s.

Reviewed by: brooks
Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7010

7 years agoWITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.
bdrewery [Wed, 29 Jun 2016 01:50:30 +0000 (01:50 +0000)]
WITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.

As the XXX notes, these should really be checking MK_GNUCXX since there is
already a version check in share/mk/src.opts.mk to disable it.  Fixing that
here is more complex though.  This could also be using X_COMPILER_FEATURES
but uses X_COMPILER_VERSION to keep in sync with the src.opts.mk logic.

Tested by: andreast
Sponsored by: EMC / Isilon Storage Division
Approved by: re (gjb)

7 years agoDo not coredump if the packet is too long in the global (non-interface
phk [Tue, 28 Jun 2016 20:10:30 +0000 (20:10 +0000)]
Do not coredump if the packet is too long in the global (non-interface
associated) instance.

The result is that the packet is dropped without an indication
that smaller MTU is advisable, which is not optimal, but better
than a NULL pointer deref.

Approved by: re (glebius)

7 years agoUse on crypto.x and rpc.x from the source tree.
bdrewery [Tue, 28 Jun 2016 19:53:16 +0000 (19:53 +0000)]
Use on crypto.x and rpc.x from the source tree.

This fixes the build when DESTDIR may be blank or not yet populated.
It also fixes reproducibility.

Submitted by: brooks
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6455

7 years agoRevert svn r302253 at the request/review of Ken M. This commit is
sbruno [Tue, 28 Jun 2016 18:32:15 +0000 (18:32 +0000)]
Revert svn r302253 at the request/review of Ken M.  This commit is
incorrect.

PR: 202625
Approved by: re (implicit)

7 years agoCorrect PERSISTENT RESERVE OUT command and populate scsi_cmd->length.
sbruno [Tue, 28 Jun 2016 18:08:47 +0000 (18:08 +0000)]
Correct PERSISTENT RESERVE OUT command and populate scsi_cmd->length.

PR: 202625
Submitted by: niakrisn@gmail.com
Reviewed by: scottl
Approved by: re (hrs)
MFC after: 2 weeks

7 years agoCurrently the ntptime code and resettodr() are Giant-locked. In
kib [Tue, 28 Jun 2016 16:43:23 +0000 (16:43 +0000)]
Currently the ntptime code and resettodr() are Giant-locked. In
particular, the Giant is supposed to protect against parallel
ntp_adjtime(2) invocations.  But, for instance, sys_ntp_adjtime() does
copyout(9) under Giant and then examines time_status to return syscall
result.  Since copyout(9) could sleep, the syscall result might be
inconsistent.

Another and more important issue is that if PPS is configured,
hardpps(9) is executed without any protection against the parallel
top-level code invocation. Potentially, this may result in the
inconsistent state of the ntptime state variables, but I cannot say
how serious such distortion is. The non-functional splclock() call in
sys_ntp_adjtime() protected against clock interrupts calling hardpps()
in the pre-SMP era.

Modernize the locking. A mutex protects ntptime data.  Due to the
hardpps() KPI legitimately serving from the interrupt filters (and
e.g. uart(4) does call it from filter), the lock cannot be sleepable
mutex if PPS_SYNC is defined.  Otherwise, use normal sleepable mutex
to reduce interrupt latency.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
Differential revision: https://reviews.freebsd.org/D6825

7 years agoDo not use Giant to prevent parallel calls to CLOCK_SETTIME(). Use
kib [Tue, 28 Jun 2016 16:42:40 +0000 (16:42 +0000)]
Do not use Giant to prevent parallel calls to CLOCK_SETTIME().  Use
private mtx in resettodr(), no implementation of CLOCK_SETTIME() is
allowed to sleep.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
X-Differential revision: https://reviews.freebsd.org/D6825

7 years agoComplete r302215. TDF_SBDRY | TDF_SERESTART and TDF_SBDRY |
kib [Tue, 28 Jun 2016 16:41:50 +0000 (16:41 +0000)]
Complete r302215.  TDF_SBDRY | TDF_SERESTART and TDF_SBDRY |
TDF_SEINTR flags values, unlike TDF_SBDRY, must be treated almost as
if TDF_SBDRY is not set for STOP signal delivery.  The only difference
is that sig_suspend_threads() should abort the sleep instead of doing
immediate suspension.

Reported by: ngie
Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Approved by: re (gjb)

7 years agoRegenerate for WITH_EXTRA_TCP_STACKS updates.
jtl [Tue, 28 Jun 2016 13:42:50 +0000 (13:42 +0000)]
Regenerate for WITH_EXTRA_TCP_STACKS updates.

Approved by: re (gjb)
Sponsored by: Juniper Networks

7 years agoDocument support for alternate TCP stacks.
jtl [Tue, 28 Jun 2016 13:37:01 +0000 (13:37 +0000)]
Document support for alternate TCP stacks.

Differential Revision: https://reviews.freebsd.org/D6940
Reviewed by: hiren
Approved by: re (gjb)
Sponsored by: Juniper Networks

7 years agoThis commit addresses regression introduceded in r302177
cy [Tue, 28 Jun 2016 07:47:42 +0000 (07:47 +0000)]
This commit addresses regression introduceded in r302177
(WITH_SYSTEM_COMPILER: Enable by default) and it's prerequisite: r300354,
caused i386 builds to fail when cross-built on an amd64 host.

Reviewed by: bdrewery, delphij, gjb
Approved by: re (gjb)

7 years agoFix userspace build after r302235: do not expose bool field of the
kib [Mon, 27 Jun 2016 23:34:53 +0000 (23:34 +0000)]
Fix userspace build after r302235: do not expose bool field of the
structure, change it to int.

The real fix is to sanitize user-visible definitions in sys/event.h,
e.g. the affected struct knlist is of no use for userspace programs.

Reported and tested by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoIf the vm_fault() handler raced with the vm_object_collapse()
kib [Mon, 27 Jun 2016 21:54:19 +0000 (21:54 +0000)]
If the vm_fault() handler raced with the vm_object_collapse()
sleepable scan, iteration over the shadow chain looking for a page
could find an OBJ_DEAD object.  Such state of the mapping is only
transient, the dead object will be terminated and removed from the
chain shortly.  We must not return KERN_PROTECTION_FAILURE unless the
object type is changed to OBJT_DEAD in the chain, indicating that
paging on this address is really impossible.  Returning
KERN_PROTECTION_FAILURE prematurely causes spurious SIGSEGV delivered
to processes, or kernel accesses to UVA spuriously failing with
EFAULT.

If the object with OBJ_DEAD flag is found, only return
KERN_PROTECTION_FAILURE when object type is already OBJT_DEAD.
Otherwise, sleep a tick and retry the fault handling.

Ideally, we would wait until the OBJ_DEAD flag is resolved, e.g. by
waiting until the paging on this object is finished.  But to do so, we
need to reference the dead object, while vm_object_collapse() insists
on owning the final reference on the collapsed object.  This could be
fixed by e.g. changing the assert to shared reference release between
vm_fault() and vm_object_collapse(), but it seems to be too much
complications for rare boundary condition.

PR: 204426
Tested by:    pho
Reviewed by:  alc
Sponsored by: The FreeBSD Foundation
X-Differential revision: https://reviews.freebsd.org/D6085
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoWhen filt_proc() removes event from the knlist due to the process
kib [Mon, 27 Jun 2016 21:52:17 +0000 (21:52 +0000)]
When filt_proc() removes event from the knlist due to the process
exiting (NOTE_EXIT->knlist_remove_inevent()), two things happen:
- knote kn_knlist pointer is reset
- INFLUX knote is removed from the process knlist.
And, there are two consequences:
- KN_LIST_UNLOCK() on such knote is nop
- there is nothing which would block exit1() from processing past the
  knlist_destroy() (and knlist_destroy() resets knlist lock pointers).
Both consequences result either in leaked process lock, or
dereferencing NULL function pointers for locking.

Handle this by stopping embedding the process knlist into struct proc.
Instead, the knlist is allocated together with struct proc, but marked
as autodestroy on the zombie reap, by knlist_detach() function.  The
knlist is freed when last kevent is removed from the list, in
particular, at the zombie reap time if the list is empty.  As result,
the knlist_remove_inevent() is no longer needed and removed.

Other changes:

In filt_procattach(), clear NOTE_EXEC and NOTE_FORK desired events
from kn_sfflags for knote registered by kernel to only get NOTE_CHILD
notifications.  The flags leak resulted in excessive
NOTE_EXEC/NOTE_FORK reports.

Fix immediate note activation in filt_procattach().  Condition should
be either the immediate CHILD_NOTE activation, or immediate NOTE_EXIT
report for the exiting process.

In knote_fork(), do not perform racy check for KN_INFLUX before kq
lock is taken.  Besides being racy, it did not accounted for notes
just added by scan (KN_SCAN).

Some minor and incomplete style fixes.

Analyzed and tested by: Eric Badger <eric@badgerio.us>
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)
Differential revision: https://reviews.freebsd.org/D6859

7 years agoFix build: explicitly reference the generated magic.h as dependency
delphij [Mon, 27 Jun 2016 06:41:11 +0000 (06:41 +0000)]
Fix build: explicitly reference the generated magic.h as dependency
of mkmagic and point its location.

Reported by: jenkins
Pointy hat to: delphij
MFC after: 2 weeks
X-MFC-With: 302221
Approved by: re (kib)

7 years agoMFV r302218: file 5.28.
delphij [Mon, 27 Jun 2016 01:29:17 +0000 (01:29 +0000)]
MFV r302218: file 5.28.

Relnotes: yes
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoVendor import of file 5.28.
delphij [Sun, 26 Jun 2016 20:59:11 +0000 (20:59 +0000)]
Vendor import of file 5.28.

7 years agoWhen sleeping waiting for either local or remote advisory lock,
kib [Sun, 26 Jun 2016 20:08:42 +0000 (20:08 +0000)]
When sleeping waiting for either local or remote advisory lock,
interrupt sleeps with the ERESTART on the suspension attempts.
Otherwise, single-threading requests are deferred until the locks are
granted for NFS files, which causes hangs.

When retrying local registration of the remotely-granted adv lock,
allow full suspension and check for suspension, for usual reasons.

Reported by: markj, pho
Reviewed by: jilles
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoRewrite sigdeferstop(9) and sigallowstop(9) into more flexible
kib [Sun, 26 Jun 2016 20:07:24 +0000 (20:07 +0000)]
Rewrite sigdeferstop(9) and sigallowstop(9) into more flexible
framework allowing to set the suspension policy for the dynamic block.
Extend the currently possible policies of stopping on interruptible
sleeps and ignoring such sleeps by two more: do not suspend at
interruptible sleeps, but interrupt them with either EINTR or ERESTART.

Reviewed by: jilles
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoEnter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.
nwhitehorn [Sun, 26 Jun 2016 18:43:42 +0000 (18:43 +0000)]
Enter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.
Most of the effect of setting MSR[SF] is that the CPU will stop ignoring
the high 32 bits of registers containing addresses in load/store
instructions. As such, the kernel was setting it only when it began to
need access to high memory. MSR[SF] also affects the operation of some
conditional instructions, however, and so setting it at late times could
subtly break code at very early times. This fixes use of the FDT mode in
loader, and FDT boot more generally, on 64-bit PowerPC systems.

Hardware provided by: IBM LTC
Approved by: re (kib)

7 years agoFix a bug introduced in r283433.
dchagin [Sun, 26 Jun 2016 16:59:59 +0000 (16:59 +0000)]
Fix a bug introduced in r283433.

[1] Remove unneeded sockaddr conversion before kern_recvit() call as the from
argument is used to record result (the source address of the received message) only.

[2] In Linux the type of msg_namelen member of struct msghdr is signed but native
msg_namelen has a unsigned type (socklen_t). So use the proper storage to fetch fromlen
from userspace and than check the user supplied value and return EINVAL if it is less
than 0 as a Linux do.

Reported by: Thomas Mueller <tmueller at sysgo dot com> [1]
Reviewed by: kib@
Approved by: re (gjb, kib)
MFC after: 3 days

7 years agoThis patch fixes two bugs related to the SCTP message recovery
tuexen [Sun, 26 Jun 2016 16:38:42 +0000 (16:38 +0000)]
This patch fixes two bugs related to the SCTP message recovery
for messages which have been put on the send queue:
* Do not report any DATA or I-DATA chunk padding.
* Correctly deal with the I-DATA chunk header instead of the DATA
  chunk header when the I-DATA extension is used.

Approved by: re (kib)
MFC after: 1 week

7 years agobhyve: improve memory size documentation
novel [Sun, 26 Jun 2016 14:44:01 +0000 (14:44 +0000)]
bhyve: improve memory size documentation

A couple of minor memory size option related nits:

 - use common name 'memsize' (instead of 'max-size' or just 'size')
 - bhyve: update usage with memsize unit suffix, drop legacy "MB"
   unit
 - bhyveload: update usage with memsize unit suffix
 - bhyve(8): document default size
 - bhyveload(8): use memsize formatting like it's done
   in bhyve(8)

Reviewed by:            wblock, grehan
Approved by:            re (kib), wblock, grehan
Differential Revision:  https://reviews.freebsd.org/D6952

7 years agoClean other flags in ncl_inactive, only. Add comment explaining why other
kib [Sun, 26 Jun 2016 14:18:28 +0000 (14:18 +0000)]
Clean other flags in ncl_inactive, only.  Add comment explaining why other
flags should be unset.

Suggested and reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Approved by: re (gjb)

7 years agoThis patch fixes a locking bug when a send() call blocks
tuexen [Sun, 26 Jun 2016 12:41:02 +0000 (12:41 +0000)]
This patch fixes a locking bug when a send() call blocks
on an SCTP socket and the association is aborted by the
peer.

Approved by: re (kib)
MFC after: 1 week

7 years agoSkip lastcomm and sa tests on unsupported architectures
asomers [Sun, 26 Jun 2016 00:53:31 +0000 (00:53 +0000)]
Skip lastcomm and sa tests on unsupported architectures

usr.bin/lastcom/tests/Makefile
usr.sbin/sa/tests/Makefile
Set allow_architectures appropriately.  These tests depend on golden
files that must be generated for each architecture, and haven't yet
been generated for all of them.

PR: 210566
PR: 204154
Reviewed by: ngie
Approved by: re (gjb)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6960

7 years agoUnbreak building of LINT kernels after r302163.
bz [Sat, 25 Jun 2016 22:24:16 +0000 (22:24 +0000)]
Unbreak building of LINT kernels after r302163.

Approved by: re (gjb)

7 years ago[net80211] re-revert the ibss "is this local to the bss" patch.
adrian [Sat, 25 Jun 2016 20:31:20 +0000 (20:31 +0000)]
[net80211] re-revert the ibss "is this local to the bss" patch.

avos@ pointed out to me that this broke IBSS merging because the rest of
the input path no longer was called for non-IBSS frames.

I committed a change to not input non-IBSS frames, which stopped
nodes being created for BSSes that weren't ours.  Unfortunately
thta stopped the input path for non-IBSS frames in general,
so the management input path didn't work.

So, I'll revert this until I come up with a better solution.
(Hopefully before 11.)

Reviewed by: avos
Approved by: re (gjb)

7 years agoRevert r302194, there are issues with some applications after changing
kib [Sat, 25 Jun 2016 20:20:24 +0000 (20:20 +0000)]
Revert r302194, there are issues with some applications after changing
the return value, in particular console-kit-daemon.

Reported by: Ivan Klymenko <fidaj@ukr.net>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoRemove reference to mroute6d in /etc/netstart.
bapt [Sat, 25 Jun 2016 12:54:27 +0000 (12:54 +0000)]
Remove reference to mroute6d in /etc/netstart.

mroute6d has been removed in r298512.

PR: 209405
Submitted by: Trond.Endrestol@ximalas.info
Approved by: re (gjb)

7 years agoThis patch fixes two bugs:
tuexen [Sat, 25 Jun 2016 12:46:18 +0000 (12:46 +0000)]
This patch fixes two bugs:
* sctp46, tcp46, and udp46 sockets are displayed as such and not as
  sctp4 6, tcp4 6, udp4 6. This bug was introduced in
  http://svnweb.freebsd.org/base?view=revision&revision=187915
* For SCTP sockets, the the -4 and -6 flags are honoured as much as
  possible. This means IPv4 sockets are handled correctly,  IPv6
  sockets are displayed as sctp46, since it is currently not possible
  to distinguish between sctp6 and sctp46.

Approved by: re (gjb)
MFC after: 1 week

7 years agoSince VOP_INACTIVE() is not guaranteed to be called, all cleanups
kib [Sat, 25 Jun 2016 11:34:06 +0000 (11:34 +0000)]
Since VOP_INACTIVE() is not guaranteed to be called, all cleanups
executed by inactive methods, must be repeated on reclaim.  In
particular, unlink and free sillyrenamed vnode both on inactivation
and reclaim.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoDo not clear robust lists pointers on fork. The forked child thread
kib [Sat, 25 Jun 2016 11:31:25 +0000 (11:31 +0000)]
Do not clear robust lists pointers on fork.  The forked child thread
lists must be functional.

Reported by: Daniel Engberg <daniel.engberg.lists@pyret.net>,
Guy Yur <guyyur@gmail.com>
Tested by: Guy Yur <guyyur@gmail.com>
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb), including the KBI change

7 years agoFor pthread_mutex_trylock() call on owned error-check or non-portable
kib [Sat, 25 Jun 2016 11:30:40 +0000 (11:30 +0000)]
For pthread_mutex_trylock() call on owned error-check or non-portable
adaptive mutex, return EDEADLK as required by POSIX.  The
pthread_mutex_lock() is already compliant.

Tested by: Guy Yur <guyyur@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agobhnd(4): Add devinfo allocation and child addition methods, modeled on
landonf [Sat, 25 Jun 2016 04:36:30 +0000 (04:36 +0000)]
bhnd(4): Add devinfo allocation and child addition methods, modeled on
pci_if.

This allows bhnd(4) to manage per-device state (such as per-core
pmu/clock refcounting) on behalf of subclass driver instances.

Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6959

7 years agoReplace mips/sentry5 with mips/broadcom
landonf [Sat, 25 Jun 2016 04:34:54 +0000 (04:34 +0000)]
Replace mips/sentry5 with mips/broadcom

The delta between SENTRY5 and BCM was already small due to BCM being
derived from SENTRY5; re-integrating the two avoids the maintenance
overhead of keeping them both in sync with bhnd(4) changes.

- Re-integrate minor SENTRY5 deltas in bcm_machdep.c
- Modify uart_cpu_chipc to allow specifying UART debug/console flags via
  kenv and device hints.
- Switch SENTRY5 to std.broadcom
- Enabled CFI flash support for SENTRY5

Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6897

7 years agobhnd(4): Perform explicit chipc child enumeration.
landonf [Sat, 25 Jun 2016 04:33:00 +0000 (04:33 +0000)]
bhnd(4): Perform explicit chipc child enumeration.

Replaces use of DEVICE_IDENTIFY with explicit enumeration of chipc
child devices using the chipc capability structure.

This is a precursor to PMU support, which requires more complex resource
assignment handling than achievable with the static device name-based
hints table.

Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by: re (gjb), adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6896

7 years agourtwn: use m_get2() in Rx path.
avos [Fri, 24 Jun 2016 23:43:19 +0000 (23:43 +0000)]
urtwn: use m_get2() in Rx path.

Replace m_getcl() with m_get2(); this fixes 'frame too long'
messages for frames, which are longer than MCLBYTES
(can be easily triggered when A-MSDU is used).

Tested with RTL8188CUS (AP) and RTL8188EU (STA).

Approved by: re (marius)

7 years agoUpdate the release notes following r302182.
gjb [Fri, 24 Jun 2016 23:42:33 +0000 (23:42 +0000)]
Update the release notes following r302182.

Approved by: re (implicit, relnotes)
Sponsored by: The FreeBSD Foundation

7 years agoTurn off MSI-X interrupt migration by default in EC2 instances; this works
cperciva [Fri, 24 Jun 2016 23:39:44 +0000 (23:39 +0000)]
Turn off MSI-X interrupt migration by default in EC2 instances; this works
around a bug in older versions of Xen and unbreaks SR-IOV (aka. "EC2
Enhanced Networking").

Approved by: re (gjb)
Thanks to: jhb, Jeremiah Lott

7 years agourtwn: fix memory leak on device restart
avos [Fri, 24 Jun 2016 23:36:22 +0000 (23:36 +0000)]
urtwn: fix memory leak on device restart

Free data buffers every time when device is stopped, not when
it is detached; they are allocated at the initialization stage.

How-to-reproduce:
1) ifconfig wlan0 create wlandev urtwn0 up
2) vmstat -m | grep USBdev
3) service netif restart
4) vmstat -m | grep USBdev

Also, remove usbd_transfer_drain() call; it is already called by
usbd_transfer_unsetup().

Tested with RTL8188CUS, STA mode.

Approved by: re (marius)

7 years agoRevert r301551, which added blacklistd(8) to sshd(8).
gjb [Fri, 24 Jun 2016 23:22:42 +0000 (23:22 +0000)]
Revert r301551, which added blacklistd(8) to sshd(8).

This change has functional impact, and other concerns raised
by the OpenSSH maintainer.

Requested by: des
PR: 210479 (related)
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation

7 years agoAdd a tunable to disable migration of MSI-X interrupts.
jhb [Fri, 24 Jun 2016 22:49:32 +0000 (22:49 +0000)]
Add a tunable to disable migration of MSI-X interrupts.

The new 'machdep.disable_msix_migration' tunable can be set to 1 to
disable migration of MSI-X interrupts.

Xen versions prior to 4.6.0 do not properly handle updates to MSI-X
table entries after the initial write.  In particular, the operation
to unmask a table entry after updating it during migration is not
propagated to the "real" table for passthrough devices causing the
interrupt to remain masked.  At least some systems in EC2 are
affected by this bug when using SRIOV.  The tunable can be set in
loader.conf as a workaround.

Submitted by: Jeremiah Lott <jlott@averesystems.com> (original patch)
Approved by: re (marius)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6947

7 years agoFix bitstring allocation on 32-bit platforms
asomers [Fri, 24 Jun 2016 21:44:46 +0000 (21:44 +0000)]
Fix bitstring allocation on 32-bit platforms

sys/sys/bitstring.h
Fix a rounding calculation that could undersize a bitstring on
32-bit platforms.

tests/sys/sys/bitstring_test.h
Add a test for bitstr_size

PR: 210260
Reported by: Mark Millard
Reviewed by: gibbs
Approved by: re (marius)
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6848

7 years agogcore: Forward pending signals when detaching from the target.
markj [Fri, 24 Jun 2016 20:21:32 +0000 (20:21 +0000)]
gcore: Forward pending signals when detaching from the target.

Otherwise gcore's ptrace attach operation can race with delivery of a
signal and cause it to be lost.

In collaboration with: Suraj Raju <sraju@isilon.com>
Reviewed by: bdrewery
Approved by: re (gjb, kib)
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

7 years agoRegenerate
bdrewery [Fri, 24 Jun 2016 20:00:39 +0000 (20:00 +0000)]
Regenerate

Approved by: re (implicit, r302177)

7 years agoWITH_SYSTEM_COMPILER: Enable by default
bdrewery [Fri, 24 Jun 2016 19:55:59 +0000 (19:55 +0000)]
WITH_SYSTEM_COMPILER: Enable by default

This improves buildworld, toolchain, kernel-toolchain, and universe targets.
See r300354 or src.conf(5) for more details.

Approved by: re (gjb)
Relnotes: yes (r300354)
Sponsored by: EMC / Isilon Storage Division

7 years agobsd.prog.mk: add "/usr/lib" to list of base system directories
emaste [Fri, 24 Jun 2016 18:45:16 +0000 (18:45 +0000)]
bsd.prog.mk: add "/usr/lib" to list of base system directories

kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add
/usr/lib to the base system directory list so that debug files are
installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug .

Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoAdd pci_get_max_payload() to fetch the PCI-express maximum payload size.
jhb [Fri, 24 Jun 2016 17:26:42 +0000 (17:26 +0000)]
Add pci_get_max_payload() to fetch the PCI-express maximum payload size.

Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D6951

7 years agoFix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
asomers [Fri, 24 Jun 2016 14:58:37 +0000 (14:58 +0000)]
Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory

sbin/sysctl/sysctl.c
Fix integer overflows in printf format strings

PR: 199673
Submitted by: Vitaly Magerya
Reviewed by: cem
Approved by: re (marius)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6941

7 years agoThe void isn't void.
bz [Fri, 24 Jun 2016 11:53:12 +0000 (11:53 +0000)]
The void isn't void.

Unbreak sparc64 and powerpc builds.

Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
MFC after: 12 days

7 years agoResolve issue with libusb C++ header file inclusion.
hselasky [Fri, 24 Jun 2016 10:55:14 +0000 (10:55 +0000)]
Resolve issue with libusb C++ header file inclusion.

Approved by: re (marius)
PR: 210509
MFC after: 1 week

7 years agoUpdate head to ALPHA5 in preparation of new snapshot builds.
gjb [Fri, 24 Jun 2016 00:05:45 +0000 (00:05 +0000)]
Update head to ALPHA5 in preparation of new snapshot builds.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

7 years agoRename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
imp [Thu, 23 Jun 2016 23:20:58 +0000 (23:20 +0000)]
Rename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
its nature.

Approved by: re
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D6811

7 years agoFix gstat's interactive f and q commands
asomers [Thu, 23 Jun 2016 23:13:14 +0000 (23:13 +0000)]
Fix gstat's interactive f and q commands

curses and libedit don't play well together. After last year's libedit
upgrade in head, they play even less well together. This change resets some
curses settings after they get screwed up by libedit calls. Without it,
gstat's interactive commands require an extra "enter", screw up the terminal
on exit, and screw up the display if the user enters an invalid filter
string.

PR: 204852
Submitted by: Keith White
Reviewed by: pfg
Approved by: re (gjb)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6934

7 years agoProerply virtualize pfsync for bringup after pf is initialized and
bz [Thu, 23 Jun 2016 22:31:44 +0000 (22:31 +0000)]
Proerply virtualize pfsync for bringup after pf is initialized and
teardown of VNETs once pf(4) has been shut down.
Properly split resources into VNET_SYS(UN)INITs and one time module
loading.
While here cover the INET parts in the uninit callpath with proper
#ifdefs.

Approved by: re (gjb)
Obtained from:  projects/vnet
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

7 years agoMake sure pflog is attached after pf is initializaed so we can
bz [Thu, 23 Jun 2016 22:31:10 +0000 (22:31 +0000)]
Make sure pflog is attached after pf is initializaed so we can
borrow pf's lock, and also make sure pflog goes after pf is gone
in order to avoid callouts in VNETs to an already freed instance.

Reported by:    Ivan Klymenko, Johan Hendriks  on current@ today
Obtained from:  projects/vnet
Sponsored by:   The FreeBSD Foundation
MFC after:      13 days
Approved by: re (gjb)

7 years agoPFSTATE_NOSYNC goes onto state_flags, not sync_state;
bz [Thu, 23 Jun 2016 21:42:43 +0000 (21:42 +0000)]
PFSTATE_NOSYNC goes onto state_flags, not sync_state;
this prevents: panic: pfsync_delete_state: unexpected sync state 8

Reviewed by: kp
Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6942

7 years agoUpdate pf(4) and pflog(4) to survive basic VNET testing, which includes
bz [Thu, 23 Jun 2016 21:34:38 +0000 (21:34 +0000)]
Update pf(4) and pflog(4) to survive basic VNET testing, which includes
proper virtualisation, teardown, avoiding use-after-free, race conditions,
no longer creating a thread per VNET (which could easily be a couple of
thousand threads), gracefully ignoring global events (e.g., eventhandlers)
on teardown, clearing various globally cached pointers and checking
them before use.

Reviewed by: kp
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6924

7 years agoTry to avoid a 2nd conditional by re-writing the loop, pause, and
bz [Thu, 23 Jun 2016 21:32:52 +0000 (21:32 +0000)]
Try to avoid a 2nd conditional by re-writing the loop, pause, and
escape clause another time.

Submitted by: jhb
Approved by: re (gjb)
MFC after: 12 days

7 years agoFix two typos in r302152.
brooks [Thu, 23 Jun 2016 21:09:07 +0000 (21:09 +0000)]
Fix two typos in r302152.

Approved by: re (implicit)

7 years agoAdd spares to struct ifnet and socket for packet pacing and/or general
np [Thu, 23 Jun 2016 21:07:15 +0000 (21:07 +0000)]
Add spares to struct ifnet and socket for packet pacing and/or general
use.  Update comments regarding the spare fields in struct inpcb.

Bump __FreeBSD_version for the changes to the size of the structures.

Reviewed by: gnn@
Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

7 years agoAdd an UPDATING entry for the pipe() -> pipe2() transition.
brooks [Thu, 23 Jun 2016 21:02:05 +0000 (21:02 +0000)]
Add an UPDATING entry for the pipe() -> pipe2() transition.

Approved by: re (gjb)
Sponsored by: DARPA, AFRL

7 years agoposixshm: Fix lock leak when mac_posixshm_check_read rejects read.
jilles [Thu, 23 Jun 2016 20:59:13 +0000 (20:59 +0000)]
posixshm: Fix lock leak when mac_posixshm_check_read rejects read.

While reading the code, I noticed that shm_read() returns without unlocking
foffset and rangelock if mac_posixshm_check_read() rejects the read.

Reviewed by: kib, jhb, rwatson
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6927

7 years agoSwitch geom_disk over to using a pool mutex.
ken [Thu, 23 Jun 2016 20:05:59 +0000 (20:05 +0000)]
Switch geom_disk over to using a pool mutex.

The GEOM disk d_mtx is only acquired on disk creation and destruction.
It is a good candidate for replacement with a pool mutex.  This eliminates
the mutex initialization and teardown and the mutex and name variables
themselves from struct disk.

sys/geom/geom_disk.h:
Take d_mtx and d_mtx_name out of struct disk.

sys/geom/geom_disk.c:
Use mtx_pool_lock() and mtx_pool_unlock() to guard the disk
initialization state instead of a dedicated mutex.

This allows removing the initialization and destruction of
d_mtx.

sys/sys/param.h:
Bump __FreeBSD_version to 1100119 for the change to struct disk.

Suggested by: jhb
Sponsored by: Spectra Logic
Approved by: re (gjb)

7 years agoAdd support for a /etc/defaults/vendor.conf override file
lidl [Thu, 23 Jun 2016 19:37:00 +0000 (19:37 +0000)]
Add support for a /etc/defaults/vendor.conf override file

Reviewed by: stas, imp
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6895

7 years agoFix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
tuexen [Thu, 23 Jun 2016 19:27:29 +0000 (19:27 +0000)]
Fix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
this code in the userland stack, it could result in a loop. This happened on iOS.
However, I was not able to reproduce this when using the code in the kernel.
Thanks to Eugen-Andrei Gavriloaie for reporting the issue and proving detailed
information to find the root of the problem.

Approved by: re (gjb)
MFC after: 1 week

7 years agoUse M_NOWAIT when allocating memory for the ACPI wakeup handler.
markj [Thu, 23 Jun 2016 19:24:38 +0000 (19:24 +0000)]
Use M_NOWAIT when allocating memory for the ACPI wakeup handler.

If the allocation attempt fails, we may otherwise VM_WAIT after a failed
attempt to reclaim contiguous memory in the requested range. After r297466,
this results in the thread going to sleep, causing a hang during boot.

Reviewed by: jkim, kib
Approved by: re (gjb)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6945

7 years agomakeroot: zero out subsecond component of time= keywords
emaste [Thu, 23 Jun 2016 19:19:44 +0000 (19:19 +0000)]
makeroot: zero out subsecond component of time= keywords

They are currently not supported by makefs(1).

PR: 194703
Reviewed by: brooks
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6925

7 years agobsdinstall: increase EFI partition size to 200MB
emaste [Thu, 23 Jun 2016 18:04:48 +0000 (18:04 +0000)]
bsdinstall: increase EFI partition size to 200MB

A larger EFI file system size will facilitate multi-boot configurations
and the installation other EFI applications like firmware update tools.
200MB matches OS X.

Note that this changes only the partition size, not the file system that
bsdinstall places there. We need to do both, but as the partition size
is difficult to adjust later make this change for now so that at least
systems installed with FreeBSD 11.0 have a partition layout with room
to grow.

Reviewed by: allanjude, imp
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6935

7 years agoRaise the WARNS level in cddl/lib
asomers [Thu, 23 Jun 2016 15:02:57 +0000 (15:02 +0000)]
Raise the WARNS level in cddl/lib

cddl/lib/libavl/Makefile
cddl/lib/libctf/Makefile
cddl/lib/libnvpair/Makefile
cddl/lib/libumem/Makefile
cddl/lib/libuutil/Makefile
Increase WARNS to the highest working level for each of these
libraries

Approved by: re (gjb, hrs)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

7 years agoIn VNET TCP teardown Do not sleep unconditionally but only if we
bz [Thu, 23 Jun 2016 11:55:15 +0000 (11:55 +0000)]
In VNET TCP teardown Do not sleep unconditionally but only if we
have any TCP connections left.

Submitted by: zec
Approved by: re (hrs)
MFC after: 13 days

7 years agoUse correct Q-counter output array.
hselasky [Thu, 23 Jun 2016 09:23:37 +0000 (09:23 +0000)]
Use correct Q-counter output array.

Sponsored by: Mellanox Technologies
Approved by: re (kib)
MFC after: 3 days

7 years agoDon't consider the socket when processing an incoming ICMP/ICMP6 packet,
tuexen [Thu, 23 Jun 2016 09:13:15 +0000 (09:13 +0000)]
Don't consider the socket when processing an incoming ICMP/ICMP6 packet,
which was triggered by an SCTP packet. Whether a socket exists, is just
not relevant.

Approved by: re (kib)
MFC after: 1 week

7 years agoIn vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
kib [Thu, 23 Jun 2016 08:28:13 +0000 (08:28 +0000)]
In vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
waiters exist, same as for vm_page_xunbusy().  If previous value of
busy_lock was VPB_SINGLE_EXCLUSIVER, no waiters existed and wakeup is
not needed.

Move common code from vm_page_xunbusy_maybelocked() and
vm_page_xunbusy_hard() to vm_page_xunbusy_locked().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoAdd a comment noting locking regime for vm_page_xunbusy().
kib [Thu, 23 Jun 2016 08:27:38 +0000 (08:27 +0000)]
Add a comment noting locking regime for vm_page_xunbusy().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

7 years agoAdd support for USB streams to the LibUSB v1.0 API and update the
hselasky [Thu, 23 Jun 2016 07:12:22 +0000 (07:12 +0000)]
Add support for USB streams to the LibUSB v1.0 API and update the
libusb(3) manual page.

Approved by: re (gjb)
Requested by: swills
MFC after: 1 week

7 years agofix deadlock-prone code in getzfsvfs()
avg [Thu, 23 Jun 2016 07:01:54 +0000 (07:01 +0000)]
fix deadlock-prone code in getzfsvfs()

getzfsvfs() called vfs_busy() in the waiting mode while having a hold on
a pool (via a call to dmu_objset_hold).  In other words,
dp_config_rwlock was held in the shared mode while a thread could be
sleeping in vfs_busy().
The pool's txg sync thread needs to take dp_config_rwlock in the
exclusive mode for some actions, e.g., for executing sync tasks.  If the
sync thread gets blocked, then any thread waiting for its sync task to
get executed is also blocked.  Which, in turn, could mean that
vfs_busy() will keep waiting indefinitely.

The solution is to use vfs_ref() in the locked section and to call
vfs_busy() only after dropping other locks.
Note that a reference on a struct mount object does not prevent an
associated zfsvfs_t object from being destroyed.  So, we have to be
careful to operate only on the struct mount object until we successfully
vfs_busy it.

Approved by: re (gjb)
MFC after: 2 weeks