jhb [Mon, 18 Jan 2016 18:27:21 +0000 (18:27 +0000)]
MFC 290728:
Export various helper variables describing the layout and size of
certain kernel structures for use by debuggers. This mostly aids
in examining cores from a kernel without debug symbols as a debugger
can infer these values if debug symbols are available.
One set of variables describes the layout of 'struct linker_file' to
walk the list of loaded kernel modules.
A second set of variables describes the layout of 'struct proc' and
'struct thread' to walk the list of processes in the kernel and the
threads in each process.
The 'pcb_size' variable is used to index into the stoppcbs[] array.
The 'vm_maxuser_address' is used to distinguish kernel virtual addresses
from user addresses. This doesn't have to be perfect, and
'vm_maxuser_address' is a cheap and simple way to differentiate kernel
pointers from simple values like TIDs and PIDs.
While here, annotate the fields in struct pcb used by kgdb on amd64
and i386 to note that their ABI should be preserved. Annotations for
other platforms will be added in the future.
asomers [Mon, 18 Jan 2016 16:41:26 +0000 (16:41 +0000)]
MFC r292573
Fix "mount -a" for NFS and ZFS filesystems with shared mountpoints
sbin/mount.c
Check whether an fstab entry has the same fstype as a mounted
filesystem before declaring it to be mounted. This will allow NFS
filesystems that share a mountpoint with a local filesystem to be
automatically mounted at boot.
This is not such an unusual situation. For example, if somebody uses
the standard installer with a ZFS root, he'll get a /usr/home
filesystem, even though he may choose to mount /usr/home over NFS.
pfg [Mon, 18 Jan 2016 15:39:32 +0000 (15:39 +0000)]
MFC r293680
ext4: add support for reading sparse files
Add support for sparse files in ext4. Also implement read-ahead, which
greatly increases the performance when transferring files from ext4.
The sparse file support has become very common in ext4.
ae [Mon, 18 Jan 2016 11:47:03 +0000 (11:47 +0000)]
MFC r293679:
Change the type of newsize argument in the smbfs_smb_setfsize() function
from int to int64.
MSDN says that SMB_SET_FILE_END_OF_FILE_INFO uses signed 64-bit integer
to specify offset, but since smbfs_smb_setfsize() has used plain int,
a value was truncated in case when offset was larger than 2G.
https://msdn.microsoft.com/en-us/library/ff469975.aspx
In particular, now `truncate -s 10G` will work correctly on the mounted
SMB share.
ngie [Mon, 18 Jan 2016 03:49:57 +0000 (03:49 +0000)]
MFC r293705:
Similar to r293704, fix theoretical leak of netconfig(3) resources in
__rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating
resources, but not completely successful by moving the endnetconfig(3) call
up before we return from the function if nconf == NULL.
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
ngie [Mon, 18 Jan 2016 03:47:46 +0000 (03:47 +0000)]
MFC r293704:
Fix theoretical leak of netconfig(3) resources in svcunix_create(..)
In the event that the getconfig(3) call in svcunix_create is partly successful,
some of the netconfig(3) resources allocated might be leaked if the call returns
NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the
resources are fully cleaned up by going to the `done` label, which will call
endnetconfig(3) for us.
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
ian [Sun, 17 Jan 2016 18:18:01 +0000 (18:18 +0000)]
MFC r293781:
Restore uart PPS signal capture polarity to its historical norm, and add an
option to invert the polarity in software. Also add an option to capture
very narrow pulses by using the hardware's MSR delta-bit capability of
latching line state changes.
tuexen [Sun, 17 Jan 2016 12:41:46 +0000 (12:41 +0000)]
MFC r292734:
Don't implicitly terminate a user message when moving it to the
send_queue and the socket is closed. This results in strange
race conditions for the application.
While there, remove a stray character.
tuexen [Sun, 17 Jan 2016 12:18:01 +0000 (12:18 +0000)]
MFC r292060:
Retire sctp_validate_no_locks().
This routine checks that there are no locks held for an inp,
without having any lock on the inp. This breaks if the inp
goes away when it is called. This happens on stress tests
on a RPi B+.
tuexen [Sun, 17 Jan 2016 12:15:41 +0000 (12:15 +0000)]
MFC r291904:
Fix the allocation of outgoing streams:
* When processing a cookie, use the number of
streams announced in the INIT-ACK.
* When sending an INIT-ACK for an existing
association, use the value from the association,
not from the end-point.
tuexen [Sun, 17 Jan 2016 11:59:42 +0000 (11:59 +0000)]
MFC r291376:
When the sending of an SCTP outgoing stream reset request fails,
don't report it to the user since all stream have been marked
as pending.
melifaro [Sun, 17 Jan 2016 06:02:59 +0000 (06:02 +0000)]
MFC r288297 (userland part).
If ever MFC is done for the new lltable code, this change will miminise
ABI breakage.
rtsock requests for deleting interface address lles started to return EPERM
instead of old "ignore-and-return 0" in r287789. This broke arp -da /
ndp -cn behavior (they exit on rtsock command failure). Fix this by
translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and
making arp/ndp ignore these entries in batched delete.
des [Sat, 16 Jan 2016 20:24:02 +0000 (20:24 +0000)]
MFH (r280630): remove all traces of SSLv2 support
MFH (r285141): remove unused variable
MFH (r288217): correctly check return value from getaddrinfo(3)
MFH (r289419): fix bugs in HTTPS tunnelling
MFH (r289420): use fopen()'s "e" mode instead of fcntl for close-on-exec
MFH (r291453, r291461): use .netrc for http servers and proxies
MFH (r292330, r292332): reset bufpos to 0 after refilling in chunked mode
tuexen [Sat, 16 Jan 2016 18:59:10 +0000 (18:59 +0000)]
MFC r291364:
When receiving an SCTP/UDP packet and the interface performed
the UDP checksum computation and signals that it was OK,
clear this bit when passing the packet to SCTP. Since the
bits indicating a valid UDP checksum and a valid SCTP
checksum are the same, the SCTP stack would assume
that also an SCTP checksum check has been performed.
tuexen [Sat, 16 Jan 2016 18:13:33 +0000 (18:13 +0000)]
MFC r291137:
Don't send SHUTDOWN chunk when the association is in a front state
and the applications calls shutdown(..., SHUT_WR) or
shutdown(..., SHUT_RDWR).
tuexen [Sat, 16 Jan 2016 18:03:12 +0000 (18:03 +0000)]
MFC r290442:
Fix typos in field names of struct sctp_extrcvinfo.
Provide defines to allow applications to compile.
Thanks to Jens Hoelscher for making me aware of the typos.
tuexen [Sat, 16 Jan 2016 18:00:47 +0000 (18:00 +0000)]
MFC r290023:
When processing a cookie, any mismatch in port numbers or the vtag results
in failing the check.
This fixes https://github.com/nplab/ETSI-SCTP-Conformance-Testsuite/blob/master/sctp-imh-tests/sctp-imh-i-3-3.pkt
tuexen [Sat, 16 Jan 2016 16:46:00 +0000 (16:46 +0000)]
MFC r287717:
Cleanup the handling of error causes for ERROR chunks. This fixes
an inconsistency of the padding handling. The final padding is
now considered to be a chunk padding.
tuexen [Sat, 16 Jan 2016 16:42:40 +0000 (16:42 +0000)]
MFC r287669:
Ensure that ERROR chunks are always padded by implementing this
in the routine, which queues an ERROR chunk, instead on relyinh
on the callers to do so. Since one caller missed this, this actially
fixes a bug.
tuexen [Sat, 16 Jan 2016 14:56:30 +0000 (14:56 +0000)]
MFC r287619:
Zero out a local variable also when PURIFY is not defined.
This silence a warning brought up by valgrind whenever if_nametoindex
is used. This was already discussed in PR 166483, but the code
committed in r234329 guards the initilization with #ifdef PURIFY.
Therefore, valgrind still complains. Since this code is not performance
critical, always zero out the local variable to silence valgrind.
tuexen [Sat, 16 Jan 2016 14:54:43 +0000 (14:54 +0000)]
MFC r287535:
RFC 4960 requires that packets containing an INIT chunk bundled with
another chunk are silently discarded. Do so, instead of sending an
ABORT.
tuexen [Sat, 16 Jan 2016 14:46:27 +0000 (14:46 +0000)]
MFC r287294:
Use 5 times RTO.Max as the default for the shutdown guard timer
as required by RFC 4960. The sysctl variable can be used to
overwrite this.
tuexen [Sat, 16 Jan 2016 12:33:45 +0000 (12:33 +0000)]
MFC r285877:
Move including netinet/icmp6.h around to avoid a problem when including
netinet/icmp6.h and net/netmap.h. Both use ni_flags...
This allows to build multistack with SCTP support.
tuexen [Sat, 16 Jan 2016 12:20:47 +0000 (12:20 +0000)]
MFC r285837, r285838
Fix an issue with MAC OS locking and also optimize the case
where we are sending back a stream-reset and a sack timer is running, in
that case we should just send the SACK.
Fix silly syntax error emacs chugged in for me.. gesh.
tuexen [Sat, 16 Jan 2016 12:15:07 +0000 (12:15 +0000)]
MFC r285792:
Fix several problems with Stream Reset.
1) We were not handling (or sending) the IN_PROGRESS case if
the other side (or our side) was not able to reset (awaiting more data).
2) We would improperly send a stream-reset when we should not. Not
waiting until the TSN had been assigned when data was inqueue.
jilles [Fri, 15 Jan 2016 20:55:44 +0000 (20:55 +0000)]
MFC r293783: futimens/utimensat: Use the new system calls.
Update the __FreeBSD_version check in lib/libc/sys/futimens.c and
lib/libc/sys/utimensat.c. Before this, fallback code using
futimes/futimesat/lutimes was used except when running on a sufficiently
recent 11-current kernel.
rpokala [Fri, 15 Jan 2016 04:05:56 +0000 (04:05 +0000)]
[PR 206219] Kernel panic from lagg_ioctl and lagg_port_ioctl
r287723 removed some cleanup from lagg(4), which leads to panics when
changing configuration. Restore the spirit of the code which was removed.
This issue has been refactored out of existence in -HEAD, so this patch is
directly against stable/10.
PR: 206219
Submitted by: Fred Lewis < flewis @ panasas.com >
Reviewed by: hiren, Daniel O'Connor < darius @ dons.net.au >
Approved by: jhb
Sponsored by: Panasas, Inc.
Differential Revision: https://reviews.freebsd.org/D4929
ngie [Fri, 15 Jan 2016 02:13:55 +0000 (02:13 +0000)]
MFC r293028,r293029:
r293028:
- Use geom <class> load instead of g<class> load; g<class> doesn't exist
for all geom classes, e.g. geom_uzip(4)
- These tests require root. Skip all of the tests if they're run as non-root
r293029:
Add functions for managing md(4) devices and cleaning up said md(4) devices
These will be used soon in the various test scripts that source geom_subr.sh
jtl [Thu, 14 Jan 2016 22:02:21 +0000 (22:02 +0000)]
MFC r290811:
Fix hwpmc "stalled" behavior
Currently, there is a single pm_stalled flag that tracks whether a
performance monitor was "stalled" due to insufficent ring buffer
space for samples. However, because the same performance monitor
can run on multiple processes or threads at the same time, a single
pm_stalled flag that impacts them all seems insufficient.
In particular, you can hit corner cases where the code fails to stop
performance monitors during a context switch out, because it thinks
the performance monitor is already stopped. However, in reality,
it may be that only the monitor running on a different CPU was stalled.
This patch attempts to fix that behavior by tracking on a per-CPU basis
whether a PM desires to run and whether it is "stalled". This lets the
code make better decisions about when to stop PMs and when to try to
restart them. Ideally, we should avoid the case where the code fails
to stop a PM during a context switch out.
MFC r290813:
Optimizations to the way hwpmc gathers user callchains
Changes to the code to gather user stacks:
* Delay setting pmc_cpumask until we actually have the stack.
* When recording user stack traces, only walk the portion of the ring
that should have samples for us.
MFC r290929:
Change the driver stats to what they really are: unsigned values.
When pmcstat exits after some samples were dropped, give the user an
idea of how many were lost. (Granted, these are global numbers, but
they may still help quantify the scope of the loss.)
MFC r290930:
Improve accuracy of PMC sampling frequency
The code tracks a counter which is the number of events until the next
sample. On context switch in, it loads the saved counter. On context
switch out, it tries to calculate a new saved counter.
Problems:
1. The saved counter was shared by all threads in a process. However, this
means that all threads would be initially loaded with the same saved
counter. However, that could result in sampling more often than once every
X number of events.
2. The calculation to determine a new saved counter was backwards. It
added when it should have subtracted, and subtracted when it should have
added. Assume a single-threaded process with a reload count of 1000
events. Assuming the counter on context switch in was 100 and the counter
on context switch out was 50 (meaning the thread has "consumed" 50 more
events), the code would calculate a new saved counter of 150 (instead of
the proper 50).
Fix:
1. As soon as the saved counter is used to initialize a monitor for a
thread on context switch in, set the saved counter to the reload count.
That way, subsequent threads to use the saved counter will get the full
reload count, assuring we sample at least once every X number of events
(across all threads).
2. Change the calculation of the saved counter. Due to the change to the
saved counter in #1, we simply need to add (modulo the reload count) the
remaining counter time we retrieve from the CPU when a thread is context
switched out.
MFC r291016:
Support a wider history counter in pmcstat(8) gmon output
pmcstat(8) contains an option to output sampling data in a gmon format
compatible with gprof(1). Currently, it uses the default histcounter,
which is an (unsigned short). With large sets of sampling data, it
is possible to overflow the maximum value provided by an (unsigned
short).
This change adds the -e argument to pmcstat. If -e and -g are both
specified, pmcstat will use a histcounter type of uint64_t.
MFC r291017:
Fix the date on the pmcstat(8) man page from r291016.
jhb [Thu, 14 Jan 2016 19:47:52 +0000 (19:47 +0000)]
Now that futimens() and utimensat() have been merged, add decoding for
those system calls that was left out of the previous merge of r286381 in
r290052.