]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoSlightly compact the code.
mav [Mon, 24 Apr 2017 12:44:04 +0000 (12:44 +0000)]
Slightly compact the code.

MFC after: 2 weeks

7 years agoCall the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
andrew [Mon, 24 Apr 2017 11:06:10 +0000 (11:06 +0000)]
Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
kernel calls this directly so the event handler is not called, meaning
the computer fails to reboot.

Tested by: cognet
MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoSwitch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.
mav [Mon, 24 Apr 2017 10:16:12 +0000 (10:16 +0000)]
Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.

MFC after: 1 week

7 years agoUse proper alignment constant for uma_zcreate().
mav [Mon, 24 Apr 2017 08:44:51 +0000 (08:44 +0000)]
Use proper alignment constant for uma_zcreate().

Previous code panicked on KASSERT with INVARIANTS enabled.

MFC after: 2 weeks

7 years agohyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.
sephe [Mon, 24 Apr 2017 07:52:27 +0000 (07:52 +0000)]
hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.

Hyper-V hot channel effect:
Operation latency on hot channel is only _half_ of the operation
latency on cold channels.

This commit takes the advantage of the above Hyper-V host channel
effect, and can reduce more than 75% latency and more than 50%
latency stdev, i.e. lower and more stable/predictable latency,
for various types of web server workloads.

MFC after: 3 days
Sponsored by: Microsoft

7 years agoFix the default uid/gid values in nfsuserd.c
rmacklem [Sun, 23 Apr 2017 23:09:02 +0000 (23:09 +0000)]
Fix the default uid/gid values in nfsuserd.c

This patch sets the default uid/gid values for "nobody" and "nogroup"
to the values in the password and group databases. Normally nfsuserd(8)
will override these with whatever is in the password/group databases,
so these values are only used when the databases entries aren't available.
It would be nice to use the definitions in sys/conf.h, but those are
in the _KERNEL section of the file.

Reported by: tez@pkgsrc.org
Submitted by: tez@pkgsrc.org
MFC after: 2 weeks

7 years agomsun: Remove trailing space in Sunsoft copyright statement.
pfg [Sun, 23 Apr 2017 22:31:12 +0000 (22:31 +0000)]
msun: Remove trailing space in Sunsoft copyright statement.

Submittedby: kargl

7 years agoMake it possible to terminate "show lockedbufs" by pressing "q".
trasz [Sun, 23 Apr 2017 22:20:25 +0000 (22:20 +0000)]
Make it possible to terminate "show lockedbufs" by pressing "q".

MFC after: 2 weeks

7 years agosh: Add tests for NUL byte in command substitution output.
jilles [Sun, 23 Apr 2017 21:58:17 +0000 (21:58 +0000)]
sh: Add tests for NUL byte in command substitution output.

7 years agoregex: unsign and constify some variables.
pfg [Sun, 23 Apr 2017 21:51:29 +0000 (21:51 +0000)]
regex: unsign and constify some variables.

Taking some hints from the regex variant in nvi(1) and higher-level
compiler warnings, update some types in our regex(3) implementation.

Joint work with: Kyle Evans
MFC after: 2 weeks

7 years agoMake the NFSv4 client to use a write open for reading if allowed by the server.
rmacklem [Sun, 23 Apr 2017 21:51:28 +0000 (21:51 +0000)]
Make the NFSv4 client to use a write open for reading if allowed by the server.

An NFSv4 server has the option of allowing a Read to be done using a Write
Open. If this is not allowed, the server will return NFSERR_OPENMODE.
This patch attempts the read with a write open and then disables this
if the server replies NFSERR_OPENMODE.
This change will avoid some uses of the special stateids. This will be
useful for pNFS/DS Reads, since they cannot use special stateids.
It will also be useful for any NFSv4 server that does not support reading
via the special stateids. It has been tested against both types of NFSv4 server.

MFC after: 2 weeks

7 years agoDon't set the connection-back-channel flag for DS sessions.
rmacklem [Sun, 23 Apr 2017 21:36:32 +0000 (21:36 +0000)]
Don't set the connection-back-channel flag for DS sessions.

The NFSv4.1/pNFS client does not use/need a backchannel for the Data Server (DS)
sessions, so the flag should only be set for MetaData Server (MDS) sessions.
This patch should have been a part of r317275.

MFC after: 2 weeks

7 years agoIn fill_ip6(), the value of the pointer av changes before it is
marius [Sun, 23 Apr 2017 21:17:59 +0000 (21:17 +0000)]
In fill_ip6(), the value of the pointer av changes before it is
free(3)ed. Thus, introduce a new variable to track the original
value.

Submitted by: Tom Rix
Differential Revision: https://reviews.freebsd.org/D9962

7 years agoImprove BUF_TRACKING by not displaying NULL entries.
trasz [Sun, 23 Apr 2017 17:39:31 +0000 (17:39 +0000)]
Improve BUF_TRACKING by not displaying NULL entries.

Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10443

7 years agoReport NTB link speed to console and interface.
mav [Sun, 23 Apr 2017 14:25:51 +0000 (14:25 +0000)]
Report NTB link speed to console and interface.

MFC after: 2 weeks

7 years agoChange the drawing method for the mouse cursor in planar mode to support
bde [Sun, 23 Apr 2017 08:59:35 +0000 (08:59 +0000)]
Change the drawing method for the mouse cursor in planar mode to support
colors.

Colors are still hard-coded as 15 (normally lightwhite) for the interior
and 0 (normally black) for the border, but these are now values used in
2 expressions instead of built in to the algorithm.  The algorithm used
a fancy and/or method, but this gives no control over the colors except
and'ing all color planes off gives black and or'ing all color planes on
gives lightwhite.  Just draw the border and interior in separate colors
using the same method as for characters, including its complications to
optimize for VGA adaptors.  Optimization is not really needed here, but
for the VGA case it avoids being slower than the and/or method.  The
optimization is worth about 30%.

7 years agoMap Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.
dchagin [Sun, 23 Apr 2017 07:57:30 +0000 (07:57 +0000)]
Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.

MFC after: 1 week

7 years agoAdd Evdev ioctl handler to the Linuxulator.
dchagin [Sun, 23 Apr 2017 07:43:50 +0000 (07:43 +0000)]
Add Evdev ioctl handler to the Linuxulator.

PR: 218627
Submitted by: Jan Kokemüller
Reported by: Jan Kokemüller
MFC after: 1 week

7 years agoMinor style(9) fixups
ngie [Sun, 23 Apr 2017 03:36:03 +0000 (03:36 +0000)]
Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoNote that getpagesize(3) can return -1 on failure
ngie [Sun, 23 Apr 2017 03:17:32 +0000 (03:17 +0000)]
Note that getpagesize(3) can return -1 on failure

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agogctl_test.t: catch errors with the mdcfg directive
ngie [Sun, 23 Apr 2017 02:30:06 +0000 (02:30 +0000)]
gctl_test.t: catch errors with the mdcfg directive

While here, add a note about certain testcases relying on `count=1024` in
the "create" portion.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix type for `pagesize` to match the return type for getpagesize(3)
ngie [Sun, 23 Apr 2017 01:50:47 +0000 (01:50 +0000)]
Fix type for `pagesize` to match the return type for getpagesize(3)
to fix the build

MFC after: 5 weeks
X-MFC with: r317311
Pointyhat to: ngie
Sponsored by: Dell EMC Isilon

7 years agoCheck for failures from getpagesize(3)
ngie [Sun, 23 Apr 2017 01:47:51 +0000 (01:47 +0000)]
Check for failures from getpagesize(3)

Return errno on failure, similar to the open(2) call above it.

MFC after: 5 weeks
Reported by: Coverity
CID: 1193753
Sponsored by: Dell EMC Isilon

7 years agoMinor style(9) fixups
ngie [Sun, 23 Apr 2017 01:17:59 +0000 (01:17 +0000)]
Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agogctl_test.t: improve error reporting with mdcfg and mount directives
ngie [Sat, 22 Apr 2017 23:30:02 +0000 (23:30 +0000)]
gctl_test.t: improve error reporting with mdcfg and mount directives

If the commands had failed previously, it would press on and result in a
series of cascading failures. Fail early and continue on to the next case
instead of executing additional commands after a previously failed series
of steps.

MFC after:      5 weeks
Sponsored by:   Dell EMC Isilon

7 years agogctl_test.t: more tweaks to try and update the code and get it functional (again?)
ngie [Sat, 22 Apr 2017 23:27:40 +0000 (23:27 +0000)]
gctl_test.t: more tweaks to try and update the code and get it functional (again?)

- Make the logfile for $out be built off the basename for $cmd, instead of $cmd.
  (r317292 broke this assumption).
- Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
  mountpoints.
- Reindent the umount directive block while here to match the rest of the code.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoUse verb=delete not verb=remove
ngie [Sat, 22 Apr 2017 23:06:53 +0000 (23:06 +0000)]
Use verb=delete not verb=remove

The `remove` verb hasn't been present in geom_part*(4) for well
over a decade, if ever. I couldn't find any references to it in
^/stable/5 at least, which is around the timeframe that this test
was written.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agogctl_test.t: minor tweaks
ngie [Sat, 22 Apr 2017 22:40:39 +0000 (22:40 +0000)]
gctl_test.t: minor tweaks

- Declare $count with the `my` scope operator to permit `use strict`.
- Add `use strict`.
- Use `use warnings` instead of using `-w` in the shebang.
- Don't unlink $cmd when done (prevents unnecessary rebuilding).
- Improve the error message when running with insufficient permissions, e.g.,
  non-root.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix the NFSv4.1/pNFS client return layout on close.
rmacklem [Sat, 22 Apr 2017 22:37:44 +0000 (22:37 +0000)]
Fix the NFSv4.1/pNFS client return layout on close.

The "return layout on close" case in the pNFS client was badly broken.
Fortunately, extant pNFS servers that I have tested against do not
do this. This patch fixes it. It also changes the way the layout stateid.seqid
is set for LayoutReturn. I think this change is correct w.r.t. the RFC,
but I am not 100% sure.
This was found during recent testing of the pNFS server under development.

MFC after: 2 weeks

7 years agogctl_test_helper: add diagnostic output for parse_retval(..)
ngie [Sat, 22 Apr 2017 22:34:45 +0000 (22:34 +0000)]
gctl_test_helper: add diagnostic output for parse_retval(..)

This will help end-users better diagnose issues with the function.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoOnly expect :grep_r_implied to pass with bsdgrep(1)
ngie [Sat, 22 Apr 2017 21:40:31 +0000 (21:40 +0000)]
Only expect :grep_r_implied to pass with bsdgrep(1)

The test fails with gnu grep from base and ports.

Sponsored by: Dell EMC Isilon

7 years agoAdd more sanity tests for grep, egrep, and fgrep
ngie [Sat, 22 Apr 2017 21:40:10 +0000 (21:40 +0000)]
Add more sanity tests for grep, egrep, and fgrep

The test suite currently lacks basic sanity checks to ensure that egrep,
fgrep, and grep are actually matching the right expression types, i.e. passing
the right flags to regcomp(3). Amend the test suite to make sure that not only
are the individual versions doing the right thing, but also that we don't have some
kind of frankenregex situation happening where egrep is accepting a BRE or
grep an ERE.

I've chosen to not expand the 'basic' test but to add the 'grep_sanity' checks
to their own test case since this is testing for more than just 'grep matches things',
but actual expression types.

Differential Revision: D10444
Reviewed by: emaste, ngie
Submitted by: Kyle Evans <kevans91@ksu.edu>
Tested with: bsdgrep, gnu grep (base, ports)
Sponsored by: Dell EMC Isilon

7 years agosh: Simplify setinteractive().
jilles [Sat, 22 Apr 2017 21:31:37 +0000 (21:31 +0000)]
sh: Simplify setinteractive().

setsignal() does nothing if the signal disposition is already set correctly.

7 years agoRemove the expected failures for :context and :context2 with bsdgrep(1)
ngie [Sat, 22 Apr 2017 21:26:15 +0000 (21:26 +0000)]
Remove the expected failures for :context and :context2 with bsdgrep(1)

They're no longer needed after recent fixes made to bsdgrep(1).

Submitted by: Kyle Evans <kevans91@ksu.edu> (via a previous diff in D10433)
Sponsored by: Dell EMC Isilon

7 years agoFix some krpc leaks for the NFSv4.1/pNFS client.
rmacklem [Sat, 22 Apr 2017 20:55:39 +0000 (20:55 +0000)]
Fix some krpc leaks for the NFSv4.1/pNFS client.

The NFSv4.1/pNFS client wasn't doing a newnfs_disconnect() call for the
connection to the Data Server (DS) under some circumstances. The main
effect of this was a leak of malloc'd structures in the krpc. This patch
adds the newnfs_disconnect() calls to fix this.
Detected during recent testing against the pNFS server under development.

MFC after: 2 weeks

7 years agoThe GPT class no longer exists; use the PART class instead
ngie [Sat, 22 Apr 2017 20:51:54 +0000 (20:51 +0000)]
The GPT class no longer exists; use the PART class instead

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoBump WARNS to 6 per previous commits which fixed warnings
ngie [Sat, 22 Apr 2017 20:29:56 +0000 (20:29 +0000)]
Bump WARNS to 6 per previous commits which fixed warnings

MFC after: 5 weeks
Tested with: clang (4.0), gcc (4.2.1, 6.3.0)
Sponsored by: Dell EMC Isilon

7 years agogctl_test_helper: apply polish
ngie [Sat, 22 Apr 2017 20:27:46 +0000 (20:27 +0000)]
gctl_test_helper: apply polish

- Staticize variables to fix warnings.
- Sprinkle asserts around for calls that can fail
- Apply style(9) for main(..) definition.
- ANSIify usage(..) definition.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agogctl_test.t: use make to compile gctl_test_helper instead of calling cc directly
ngie [Sat, 22 Apr 2017 20:15:47 +0000 (20:15 +0000)]
gctl_test.t: use make to compile gctl_test_helper instead of calling cc directly

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoRename gctl.t to gctl_test.t and test.c to gctl_test_helper.c
ngie [Sat, 22 Apr 2017 20:06:11 +0000 (20:06 +0000)]
Rename gctl.t to gctl_test.t and test.c to gctl_test_helper.c

This is being done to reduce ambiguity and to make the tests more portable
in the future to other locations in the source tree.

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix -Wimplicit-function-declaration compilation warning by moving libgeom.h
ngie [Sat, 22 Apr 2017 20:00:52 +0000 (20:00 +0000)]
Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
#include below the stdio.h #include.

gctl_dump(3) needs stdio.h, per reasoning noted in r317289.

MFC after: 5 weeks
PR: 218809
Submitted by: Chang-Hsien Tsai <luke.tw@gmail.com>
Sponsored by: Dell EMC Isilon

7 years agolibgeom(3): note that stdio.h is required when referencing gctl_dump(3)
ngie [Sat, 22 Apr 2017 19:32:23 +0000 (19:32 +0000)]
libgeom(3): note that stdio.h is required when referencing gctl_dump(3)

gctl_dump(3) is only exposed when stdio.h is #include'd first, per its
addition in r112510. The reasoning noted for the conditional "exposure"
of the function was to "limit #include pollution".

This addresses an issue I found with the documentation when looking at
bug 218809, which in turn addresses a -Wimplicit-function-declaration
compiler warning in `tools/regression/geom_gpt/test.c` (it uses
gctl_dump(3)).

MFC after: 5 weeks
Sponsored by: Dell EMC Isilon

7 years agolibgeom(3): apply minor polish
ngie [Sat, 22 Apr 2017 19:11:37 +0000 (19:11 +0000)]
libgeom(3): apply minor polish

- Use .Dv when mentioning NULL per mdoc(7).
- Reword `g_device_path`, `g_open_by_ident`, and `g_providername`'s descriptions
  so they're less wordy.
- Fix a typo in `g_device_path` (can not -> cannot).

MFC after: 5 weeks
Tested with: igor, make manlint
Sponsored by: Dell EMC Isilon

7 years agopmcstat(8); unsign some allocation variables and use reallocarray(3).
pfg [Sat, 22 Apr 2017 16:02:40 +0000 (16:02 +0000)]
pmcstat(8); unsign some allocation variables and use reallocarray(3).

Use unsigned values in some internal variables that will be used during
allocation. The variables are used in reduced scope and have no chance of
becoming negative.

Provide bounds checking through reallocarray(3).

MFC after: 2 weeks

7 years agofsck_ffs: Unsign some variables and make use of reallocarray(3).
pfg [Sat, 22 Apr 2017 14:50:11 +0000 (14:50 +0000)]
fsck_ffs: Unsign some variables and make use of reallocarray(3).

Instead of casting listmax and numdirs to unsigned values just define
them as unsigned and avoid the casts. Use reallocarray(3).

While here, fs_ncg is already unsigned so the cast is unnecessary.

Reviewed by: mckusick
MFC after: 2 weeks

7 years agoRename variable for clarity
kp [Sat, 22 Apr 2017 13:04:36 +0000 (13:04 +0000)]
Rename variable for clarity

Rename the mtu variable in ip6_fragment(), because mtu is misleading. The
variable actually holds the fragment length.
No functional change.

Suggested by: ae

7 years agoAdd basic example to the cu(1) man page. Srsly, folks, you don't
trasz [Sat, 22 Apr 2017 09:38:43 +0000 (09:38 +0000)]
Add basic example to the cu(1) man page.  Srsly, folks, you don't
need to install minicom for this...

MFC after: 2 weeks

7 years agoRemove unneeded conditions.
mav [Sat, 22 Apr 2017 08:38:49 +0000 (08:38 +0000)]
Remove unneeded conditions.

MFC after: 2 weeks

7 years ago[net80211] add methods to fetch the global and per-VAP WME parameters.
adrian [Sat, 22 Apr 2017 02:12:07 +0000 (02:12 +0000)]
[net80211] add methods to fetch the global and per-VAP WME parameters.

For now there isn't any per-VAP WME state.  The eventual aim is to migrate
the driver direct use of WME parameters over to use these methods as
appropriate (global for most devices, per-VAP for firmware NICs that support
it) in preparation for actual per-VAP WME (and other thing) state change
support.

7 years agoFix counter increment in Salsa and ChaCha.
des [Sat, 22 Apr 2017 01:06:23 +0000 (01:06 +0000)]
Fix counter increment in Salsa and ChaCha.

In my eagerness to eliminate a branch which is taken once per 2^38
bytes of keystream, I forgot that the state words are in host order.
Thus, the counter increment code worked fine on little-endian
machines, but not on big-endian ones.  Switch to a simpler (branchful)
solution.

7 years agoDon't set ND_NOMOREDATA for a failed Setattr operation (NFSv4).
rmacklem [Fri, 21 Apr 2017 23:01:32 +0000 (23:01 +0000)]
Don't set ND_NOMOREDATA for a failed Setattr operation (NFSv4).

The NFSv4 Setattr operation always has reply data even when it fails,
so don't set the ND_NOMOREDATA for it. This would only affect unusual
cases where Setattr fails and the RPC code wants to parse the rest of
the compound. Detected during recent development related to the pNFS server.

MFC after: 2 weeks

7 years agoDon't create a backchannel for a DS connection.
rmacklem [Fri, 21 Apr 2017 22:38:26 +0000 (22:38 +0000)]
Don't create a backchannel for a DS connection.

An NFSv4.1 client connection to a Data Server (DS) should not have a
backchannel. This patch fixes the NFSv4.1/pNFS client to not do a backchannel
for this case.
Found during recent testing with the pNFS server under development.

MFC after: 2 weeks

7 years agoStr_Match: fix closure tests for [^] and add unit-test.
sjg [Fri, 21 Apr 2017 22:19:13 +0000 (22:19 +0000)]
Str_Match: fix closure tests for [^] and add unit-test.

7 years agofuse: Implement FOPEN_KEEP_CACHE flag
cem [Fri, 21 Apr 2017 22:00:22 +0000 (22:00 +0000)]
fuse: Implement FOPEN_KEEP_CACHE flag

Implement FUSE open flag FOPEN_KEEP_CACHE.  Without this flag, cached file
contents should be invalidated on open.  Apparently, fusefs-encfs relies
upon this behavior.

PR: 218636
Submitted by: Ben RUBSON <ben.rubson at gmail.com>

7 years agoAdd checks for failed operations to the NFSv4 client function nfscl_mtofh().
rmacklem [Fri, 21 Apr 2017 21:43:00 +0000 (21:43 +0000)]
Add checks for failed operations to the NFSv4 client function nfscl_mtofh().

The nfscl_mtofh() function didn't check for failed operations and, as such,
would have returned EBADRPC for these cases, due to parsing failure.
This patch adds checks, so that it returns with ND_NOMOREDATA set.
This is needed for future use in the pNFS server and acts as a safety
belt in the meantime.

MFC after: 2 weeks

7 years agoGet rid of bogus statement in the nfsuserd.8 man page.
rmacklem [Fri, 21 Apr 2017 20:53:51 +0000 (20:53 +0000)]
Get rid of bogus statement in the nfsuserd.8 man page.

The nfsuserd.8 man page stated that a usertimeout of 0 would disable
the cache timeout. This was simply not true, so this patch deletes
the sentence.

This is a content change.

PR: 217406
MFC after: 2 weeks

7 years agoSet default uid/gid to nobody/nogroup for NFSv4 mapping.
rmacklem [Fri, 21 Apr 2017 20:08:10 +0000 (20:08 +0000)]
Set default uid/gid to nobody/nogroup for NFSv4 mapping.

The default uid/gid for NFSv4 are set by the nfsuserd(8) daemon.
However, they were 0 until the nfsuserd(8) was run. Since it is
possible to use NFSv4 without running the nfsuserd(8) daemon, set them
to nobody/nogroup initially.
Without this patch, the values would be set by the nfsuserd(8) daemon
and left changed even if the nfsuserd(8) daemon was killed. The default
values of 0 meant that setting a group to "wheel" would fail even when
done by root.
It also adds a definition of GID_NOGROUP to sys/conf.h.

Discussed on: freebsd-current@
MFC after: 2 weeks

7 years agoMFV 316891
jpaetzel [Fri, 21 Apr 2017 19:53:52 +0000 (19:53 +0000)]
MFV 316891

7386 zfs get does not work properly with bookmarks

illumos/illumos-gate@edb901aab9c738b5eb15aa55933e82b0f2f9d9a2
https://github.com/illumos/illumos-gate/commit/edb901aab9c738b5eb15aa55933e82b0f2f9d9a2

https://www.illumos.org/issues/7386
  The zfs get command does not work with the bookmark parameter while it works
  properly with both filesystem and snapshot:
  # zfs get -t all -r creation rpool/test
  NAME               PROPERTY  VALUE                  SOURCE
  rpool/test         creation  Fri Sep 16 15:00 2016  -
  rpool/test@snap    creation  Fri Sep 16 15:00 2016  -
  rpool/test#bkmark  creation  Fri Sep 16 15:00 2016  -
  # zfs get -t all -r creation rpool/test@snap
  NAME             PROPERTY  VALUE                  SOURCE
  rpool/test@snap  creation  Fri Sep 16 15:00 2016  -
  # zfs get -t all -r creation rpool/test#bkmark
  cannot open 'rpool/test#bkmark': invalid dataset name
  #
  The zfs get command should be modified to work properly with bookmarks too.

Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Marcel Telka <marcel@telka.sk>

7 years agolib: initial use of reallocarray(3).
pfg [Fri, 21 Apr 2017 19:27:33 +0000 (19:27 +0000)]
lib: initial use of reallocarray(3).

Make some use of reallocarray, attempting to limit it to cases where the
parameters are unsigned and there is some theoretical chance of overflow.

MFC afer: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9980

7 years agoOptimize setting of the foreground color in the main planar method much
bde [Fri, 21 Apr 2017 17:57:23 +0000 (17:57 +0000)]
Optimize setting of the foreground color in the main planar method much
like for the background color.

This is a about 5% faster for output that actually reaches the screen.

7 years agoMerge the main ega drawing method into the main vga planar method and
bde [Fri, 21 Apr 2017 15:12:43 +0000 (15:12 +0000)]
Merge the main ega drawing method into the main vga planar method and
remove the former.

All other EGA/VGA methods were already shared, with VGA-only features
mostly not used and no decisions in inner loops to optimize fof VGA,
but this method was split up because it is the only important one and
using VGA methods if possible is about twice as fast.  The speed is
mostly not from splitting to reduce branches but from doing half as
many bus accesses, so make this easier to maintain by not splitting.
There is now 1 extra branch in an inner loop where it costs less than
1% of the bus access overhead on Haswell even if the compiler schedules
it poorly.

7 years agobsdgrep: disable GNU_GREP_COMPAT by default
emaste [Fri, 21 Apr 2017 14:50:29 +0000 (14:50 +0000)]
bsdgrep: disable GNU_GREP_COMPAT by default

The GNU extension bits in the base system are old, no longer faithful
to upstream, and surprising in some regards. Switch to documenting
WITH_GNU_GREP_COMPAT and default GNU_GREP_COMPAT to OFF in the name of
good behavior.

According to http://www.regular-expressions.info, GNU extensions:

-  Add missing quantifiers to BREs: \?, \+

-  Add branching to BREs: \|

-  Add backreferences (\1 through \9) to EREs

-  Add \w, \W, \s, and \S corresponding to :alnum:, [^[:alnum:]],
   :space:, and [^[:space:]] respectively

-  Add word boundaries and anchors:
   \b: word boundary
   \B: not word boundary
   \<: Strt of word
   \>: End of word
   \`: Start of subject string
    \': End of subject string

These extensions are still available in /usr/bin/grep by default today,
as it is still GNU grep.  As part of the bsdgrep migration plan these
extensions may be added to bsdgrep's regex support if necessary.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10114

7 years agobsdgrep: add BSD_GREP_FASTMATCH knob for built-in fastmatch
emaste [Fri, 21 Apr 2017 14:36:09 +0000 (14:36 +0000)]
bsdgrep: add BSD_GREP_FASTMATCH knob for built-in fastmatch

Bugs have been found in the fastmatch implementation as used in bsdgrep.
Some have been fixed (r316495) while fixes for others are in review
(D10098).

In comparison with the fastmatch implementation, Kyle Evans found that:

- regex(3)'s performance with literal expressions offers a speed
  improvement over fastmatch

- regex(3)'s performance, both with simple BREs and EREs, seems to be
  comparable

The regex implementation was imported in r226035, and the commit message
reports:

    This is a temporary solution until the whole regex library is
    not replaced so that BSD grep development can continue and the
    backported code gets some review and testing. This change only
    improves scalability slightly, there is no big performance boost
    yet but several minor bugs have been found and fixed.

Introduce a WITH_/WITHOUT_BSD_GREP_FASTMATCH knob to support testing
of both approaches.

PR: 175314, 194823
Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: bdrewery (in part)
Differential Revision: https://reviews.freebsd.org/D10282

7 years agoAdd interface reference counting to if_lagg.
mav [Fri, 21 Apr 2017 13:45:01 +0000 (13:45 +0000)]
Add interface reference counting to if_lagg.

Using plain ifunit() looks like request for troubles.

MFC after: 2 weeks

7 years agoSimplify gnu/usr.bin Makefile conditions
emaste [Fri, 21 Apr 2017 13:39:14 +0000 (13:39 +0000)]
Simplify gnu/usr.bin Makefile conditions

After r307655 MK_GDB is forced to no if MK_BINUTILS is no, and similarly
MK_GROFF is forced to no if MK_CXX is no, so we can remove nested
conditionals.

Reviewed by: bapt, brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8287

7 years agoRevert r317240. I didn't realize there were defined constants for
rmacklem [Fri, 21 Apr 2017 11:48:12 +0000 (11:48 +0000)]
Revert r317240. I didn't realize there were defined constants for
uid/gid values in sys/conf.h. I will do another commit using those.

7 years agoDump md_iterations as signed, which it really is.
mav [Fri, 21 Apr 2017 07:43:44 +0000 (07:43 +0000)]
Dump md_iterations as signed, which it really is.

PR: 208305
PR: 196834
MFC after: 2 weeks

7 years agoAlways allow setting number of iterations for the first time.
mav [Fri, 21 Apr 2017 07:16:07 +0000 (07:16 +0000)]
Always allow setting number of iterations for the first time.

Before this change it was impossible to set number of PKCS#5v2 iterations,
required to set passphrase, if it has two keys and never had any passphrase.
Due to present metadata format limitations there are still cases when number
of iterations can not be changed, but now it works in cases when it can.

PR: 218512
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10338

7 years agoOops, the previous commit swapped the main ega method with the main
bde [Fri, 21 Apr 2017 06:55:17 +0000 (06:55 +0000)]
Oops, the previous commit swapped the main ega method with the main
vga planar method (for testing that was supposed to be local that the
former still works).  The ega method works on vga but is about twice
as slow.  The vga method doesn't work on ega.

Optimize the main vga planar method a little.  For changing the
background color (which was otherwise optimized better than most
things), don't switch the write mode from 3 to 0 just to select
the pixel mask of 0xff obscurely by writing 0.  Just write 0xff
directly.

7 years agoRepresent "a syncache overflow hasn't happend yet" by using
tuexen [Fri, 21 Apr 2017 06:05:34 +0000 (06:05 +0000)]
Represent "a syncache overflow hasn't happend yet" by using
-(SYNCOOKIE_LIFETIME + 1) instead of INT64_MIN, since it is
good enough and works when time_t is int32 or int64.
This fixes the issue reported by cy@ on i386.

Reported by: cy
MFC after: 1 week
Sponsored by: Netflix, Inc.

7 years agoSet default uid/gid to nobody/nogroup for NFSv4 mapping.
rmacklem [Fri, 21 Apr 2017 01:50:41 +0000 (01:50 +0000)]
Set default uid/gid to nobody/nogroup for NFSv4 mapping.

The default uid/gid for NFSv4 are set by the nfsuserd(8) daemon.
However, they were 0 until the nfsuserd(8) was run. Since it is
possible to use NFSv4 without running the nfsuserd(8) daemon, set them
to nobody/nogroup initially.
Without this patch, the values would be set by the nfsuserd(8) daemon
and left changed even if the nfsuserd(8) daemon was killed. Also, the default
values of 0 meant that setting a group to "wheel" would fail even when
done by root and this patch fixes this issue.

MFC after: 2 weeks

7 years agoMerge bmake-20170420
sjg [Fri, 21 Apr 2017 00:45:44 +0000 (00:45 +0000)]
Merge bmake-20170420

7 years agoMFV 316871
jpaetzel [Fri, 21 Apr 2017 00:24:59 +0000 (00:24 +0000)]
MFV 316871

7490 real checksum errors are silenced when zinject is on

illumos/illumos-gate@6cedfc397d92d64e442f0aae4445ac507beaf58f
https://github.com/illumos/illumos-gate/commit/6cedfc397d92d64e442f0aae4445ac507beaf58f

https://www.illumos.org/issues/7490
  When zinject is on, error codes from zfs_checksum_error() can be overwritten
  due to an incorrect and overly-complex if condition.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

7 years agoMFV 316870
jpaetzel [Fri, 21 Apr 2017 00:17:54 +0000 (00:17 +0000)]
MFV 316870

7448 ZFS doesn't notice when disk vdevs have no write cache

illumos/illumos-gate@295438ba3230419314faaa889a2616f561658bd5
https://github.com/illumos/illumos-gate/commit/295438ba3230419314faaa889a2616f561658bd5

https://www.illumos.org/issues/7448
       I built a SmartOS image with all the NVMe commits including 7372
       (support NVMe volatile write cache) and repeated my dd testing:
       > #!/bin/bash
       > for i in `seq 1 1000`; do
       > dd if=/dev/zero of=file00 bs=1M count=102400 oflag=sync &
       > dd if=/dev/zero of=file01 bs=1M count=102400 oflag=sync &
       > wait
       > rm file00 file01
       > done
       >
       Previously each dd command took ~145 seconds to finish, now it takes
       ~400 seconds.
       Eventually I figured out it is 7372 that causes unnecessary
       nvme_bd_sync() executions which wasted CPU cycles.
  If a NVMe device doesn't support a write cache, the nvme_bd_sync function will
  return ENOTSUP to indicate this to upper layers.
  It seems this returned value is ignored by ZFS, and as such this bug is not
  really specific to NVMe. In vdev_disk_io_start() ZFS sends the flush to the
  disk driver (blkdev) with a callback to vdev_disk_ioctl_done(). As nvme filled
  in the bd_sync_cache function pointer, blkdev will not return ENOTSUP, as the
  nvme driver in general does support cache flush. Instead it will issue an
  asynchronous flush to nvme and immediately return 0, and hence ZFS will not set
  vdev_nowritecache here. The nvme driver will at some point process the cache
  flush command, and if there is no write cache on the device it will return
  ENOTSUP, which will be delivered to the vdev_disk_ioctl_done() callback. This
  function will not check the error code and not set nowritecache.
  The right place to check the error code from the cache flush is in
  zio_vdev_io_assess(). This would catch both cases, synchronous and asynchronous
  cache flushes. This would also be independent of the implementation detail that
  some drivers can return ENOTSUP immediately.

Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Obtained from: Illumos

7 years agoFix the setting of atime for Linux client NFSv4 mounts.
rmacklem [Fri, 21 Apr 2017 00:17:47 +0000 (00:17 +0000)]
Fix the setting of atime for Linux client NFSv4 mounts.

The FreeBSD NFSv4 server did not set the attribute bit for TimeAccess in
the reply to an Open with exclusive_create, as required by the RFCs.
(This is required since the FreeBSD NFS server stores the create_verifier
 in the va_atime attribute.)
As such, the Linux NFSv4 client did not set the TimeAccess (atime) in
the Setattr done in an RPC after the one with the Open/exclusive_create.
This patch fixes the server to set the TimeAccess bit in the reply.

I believe that storing the create_verifier in an extended attribute for
file systems that support extended attributes might be a good idea,
but I will wait for a discussion of this on the freebsd-fs@ email list
before considering committing a patch to do this.

Reported by: jim@ks.uiuc.edu
Suggested by: dfr
MFC after: 2 weeks

7 years agoMFV 316868
jpaetzel [Fri, 21 Apr 2017 00:12:47 +0000 (00:12 +0000)]
MFV 316868

7430 Backfill metadnode more intelligently

illumos/illumos-gate@af346df58864e8fe897b1ff1a3a4c12f9294391b
https://github.com/illumos/illumos-gate/commit/af346df58864e8fe897b1ff1a3a4c12f9294391b

https://www.illumos.org/issues/7430
  Description and patch from brought over from the following ZoL commit: https://
  github.com/zfsonlinux/zfs/commit/68cbd56e182ab949f58d004778d463aeb3f595c6
  Only attempt to backfill lower metadnode object numbers if at least
  4096 objects have been freed since the last rescan, and at most once
  per transaction group. This avoids a pathology in dmu_object_alloc()
  that caused O(N^2) behavior for create-heavy workloads and
  substantially improves object creation rates. As summarized by
  @mahrens in #4636:
  "Normally, the object allocator simply checks to see if the next
  object is available. The slow calls happened when dmu_object_alloc()
  checks to see if it can backfill lower object numbers. This happens
  every time we move on to a new L1 indirect block (i.e. every 32 *
  128 = 4096 objects). When re-checking lower object numbers, we use
  the on-disk fill count (blkptr_t:blk_fill) to quickly skip over
  indirect blocks that don?t have enough free dnodes (defined as an L2
  with at least 393,216 of 524,288 dnodes free). Therefore, we may
  find that a block of dnodes has a low (or zero) fill count, and yet
  we can?t allocate any of its dnodes, because they've been allocated
  in memory but not yet written to disk. In this case we have to hold
  each of the dnodes and then notice that it has been allocated in
  memory.
  The end result is that allocating N objects in the same TXG can
  require CPU usage proportional to N^2."
  Add a tunable dmu_rescan_dnode_threshold to define the number of
  objects that must be freed before a rescan is performed. Don't bother
  to export this as a module option because testing doesn't show a
  compelling reason to change it. The vast majority of the performance
  gain comes from limit the rescan to at most once per TXG.

Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Ned Bass <bass6@llnl.gov>

Obtained from: Illumos

7 years ago- When reading VM stats, provide proper size argument to sysctl.
glebius [Fri, 21 Apr 2017 00:00:23 +0000 (00:00 +0000)]
- When reading VM stats, provide proper size argument to sysctl.
- While here, remove unused arguments from mysysctl().

7 years agoFix systat(1) regression. It was broken by r317061.
jkim [Thu, 20 Apr 2017 22:30:39 +0000 (22:30 +0000)]
Fix systat(1) regression.  It was broken by r317061.

7 years agolibthread_db: unbreak build due to sign/unsigned comparison.
pfg [Thu, 20 Apr 2017 21:01:59 +0000 (21:01 +0000)]
libthread_db: unbreak build due to sign/unsigned comparison.

Reported by: lwshu

7 years agoAdd function and data sections when building llvm, clang, lld and lldb,
dim [Thu, 20 Apr 2017 21:00:09 +0000 (21:00 +0000)]
Add function and data sections when building llvm, clang, lld and lldb,
and allow the linker to garbage collect them.  This shaves off up to a
few MB from the final executables.

MFC after: 3 days

7 years agoTurn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked
dim [Thu, 20 Apr 2017 21:00:04 +0000 (21:00 +0000)]
Turn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked
properly anyway.  (Upstream has reorganized this somewhat in the mean
time, but for proper backtraces we would need llvm-symbolizer in base.)

MFC after: 3 days

7 years agoReorder the minimum_cmd_size code to make it a little smaller and
scottl [Thu, 20 Apr 2017 20:46:34 +0000 (20:46 +0000)]
Reorder the minimum_cmd_size code to make it a little smaller and
easier to read.

7 years agoMention GEOM_MOUNTVER.
trasz [Thu, 20 Apr 2017 20:06:51 +0000 (20:06 +0000)]
Mention GEOM_MOUNTVER.

MFC after: 2 weeks

7 years agoGNU diff is done and GNU diff3 is not using libgnuregex, so no need to
bapt [Thu, 20 Apr 2017 19:33:00 +0000 (19:33 +0000)]
GNU diff is done and GNU diff3 is not using libgnuregex, so no need to
condition the build of libgnuregex anymore on WITHOUT_GNU_DIFF

7 years agoOnly build libreadline for gdb, binutils actually does not need it
bapt [Thu, 20 Apr 2017 19:29:35 +0000 (19:29 +0000)]
Only build libreadline for gdb, binutils actually does not need it

7 years agoReplace again GNU diff with BSD diff
bapt [Thu, 20 Apr 2017 19:24:51 +0000 (19:24 +0000)]
Replace again GNU diff with BSD diff

After a firts failed attempt, BSD diff is now good enough to replace
GNU diff.

Relnotes: yes

7 years agoSyncoockies can be used in combination with the syncache. If the cache
tuexen [Thu, 20 Apr 2017 19:19:33 +0000 (19:19 +0000)]
Syncoockies can be used in combination with the syncache. If the cache
overflows, syncookies are used.
This patch restricts the usage of syncookies in this case: accept
syncookies only if there was an overflow of the syncache recently.
This mitigates a problem reported in PR217637, where is syncookie was
accepted without any recent drops.
Thanks to glebius@ for suggesting an improvement.

PR: 217637
Reviewed by: gnn, glebius
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D10272

7 years agoCross reference pr(1) which diff might call with -l option
bapt [Thu, 20 Apr 2017 19:14:52 +0000 (19:14 +0000)]
Cross reference pr(1) which diff might call with -l option

7 years agoUpdate the TODO list to reflect what has been changed
bapt [Thu, 20 Apr 2017 19:07:52 +0000 (19:07 +0000)]
Update the TODO list to reflect what has been changed

7 years agoDocument all long options
bapt [Thu, 20 Apr 2017 19:05:43 +0000 (19:05 +0000)]
Document all long options

7 years agoReadd Big5: some large databases setup are still requiring it.
bapt [Thu, 20 Apr 2017 18:21:50 +0000 (18:21 +0000)]
Readd Big5: some large databases setup are still requiring it.

Reported by: "張君天(Chun-Tien Chang)" <tcs@kitty.2y.idv.tw>

7 years agolibpthread_db: undo the memset size change.
pfg [Thu, 20 Apr 2017 17:58:27 +0000 (17:58 +0000)]
libpthread_db: undo the memset size change.

I inadvertedly soubled the size of the memset without noticing the
start address had changed. The size for the memset in pt_map_thread()
shouldn't actually match the reallocarray() so undo that part of r317200.

This is a re-commit of r317201 to clarify the log.

X-MFC with: r317200

7 years agoRevert r317201 to fix the log.
pfg [Thu, 20 Apr 2017 17:54:59 +0000 (17:54 +0000)]
Revert r317201 to fix the log.

7 years agolibpthread_db: leave the memset size from unchanged.
pfg [Thu, 20 Apr 2017 17:49:37 +0000 (17:49 +0000)]
libpthread_db: leave the memset size from unchanged.

The size for the memset in pt_map_thread() shouldn't actually match the
reallocarray() so undo that part of r317200.

X-MFC with: r317200

7 years agolibthread_db: unsign map_len and use reallocarray(3).
pfg [Thu, 20 Apr 2017 17:43:25 +0000 (17:43 +0000)]
libthread_db: unsign map_len and use reallocarray(3).

Lengths are not negative, so map_len should be unsigned. Unsign the
corresponding indexes too and bring a small use of reallocarray(3).

Reorder the memset to be consistent with the realloc: it appears we
were only clearing half the memory in pt_map_thread().

MFC after: 2 weeks

7 years agoEliminate the ega renderer switch. It did nothing useful except hold
bde [Thu, 20 Apr 2017 17:22:03 +0000 (17:22 +0000)]
Eliminate the ega renderer switch.  It did nothing useful except hold
a pointer to the main ega drawing method which is misoptimized be in
a different function than the main vga planar mode drawing method.
Vga initialization handles everything with no extra code except for
selecting the different function.

7 years agoWhen the character width is 9, remove vertical lines in the mouse cursor
bde [Thu, 20 Apr 2017 16:34:09 +0000 (16:34 +0000)]
When the character width is 9, remove vertical lines in the mouse cursor
corresponding to the gaps between characters.  This fixes distortion
of the cursor due to expanding it across the gaps.

Again for character width 9, when the cursor characters are not in the
graphics range (0xb0-0xdf), the gaps were always there (filled in the
background color for the previous char).  They still look strange, but
don't cause distortion.  When the cursor characters are in the graphics
range, the gaps are filled by repeating the previous line.  This gives
distortion with cilia.  Removing vertical lines reduces the distortion
to vertical cilia.

Move the default for the cursor characters out of the graphics range.
With character width 9, this gives gaps instead of distortion and
other problems.  With character width 8, it just fixes a smaller set
of other problems.  Some distortion and other problems can be recovered
using vidcontrol -M.  Presumably the default was to fill the gaps
intentionally, but it is much better to leave gaps.  The gaps can even
be considered as a feature for text processing -- they give sub-pointers
to character boundaries.  The other problems are: (1) with character
width 9, characters near the cursor are moved into the graphics range
and thus distorted if any of their 8th bits is set; (2) conflicts with
national characters in the graphics range.

The default range for the graphics cursor characters is now 8-11.  This
doesn't conflict with anything, since the glyphs for the characters in
this range are unreachable.

Use the 10x16 mouse cursor in text mode too (if the font size is >= 14).

When the character width is 9, removal of 1 or 2 vertical lines makes
10x16 cursor no wider than the 9x13 one usually was.  We could even
handle cursors 1 pixel wider in 2 character cells and gaps without
more clipping than given by the gaps (the worst case is 1 pixel in the
left cell, 1 removed in the middle gap, 8 in the right cell and 1
removed in the right gap.  The pixel in the right gap is removed so
it doesn't matter if it is in the font).

When the character width is 8, we now clip the 10-wide cursor by 1
pixel in the worst case.  This clipping is usually invisible since it
is of the border and and the border usually merges with the background
so is invisible.  There should be an option to use reverse video to
highlight the border and its tip instead of the interior (graphics
mode can do better using separate colors).  This needs the 9x13 cursor
again.

Ideas from: ache (especially about the bad default character range)

7 years agoRestrict the arm64 supervisor all instructions to only allow a zero
andrew [Thu, 20 Apr 2017 15:53:20 +0000 (15:53 +0000)]
Restrict the arm64 supervisor all instructions to only allow a zero
immediate value for system calls. We may wish to use other values in the
future for other purposes.

MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoWrite-combine framebuffer writes through user-space mappings, if possible.
kib [Thu, 20 Apr 2017 15:18:15 +0000 (15:18 +0000)]
Write-combine framebuffer writes through user-space mappings, if possible.

Note that KVA mapping of the framebuffer already uses write-combining
mode, so the change, besides improving speed of user mode writes, also
satisfies requirement of the IA32 architecture of using consistent
caching modes for multiple mappings of the same page.

Reported and tested by: bde
Sponsored by: The FreeBSD Foundation
MFC after:  1 week

7 years agoUpdate comment ot reflect realilty, we know also take care of CPUs that
cognet [Thu, 20 Apr 2017 15:06:16 +0000 (15:06 +0000)]
Update comment ot reflect realilty, we know also take care of CPUs that
provide a enable-method.

Suggested by: jhibbits