]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoBuild getty(8) with WARNS=6.
trasz [Wed, 21 Feb 2018 15:57:24 +0000 (15:57 +0000)]
Build getty(8) with WARNS=6.

Reviewed by: imp@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14197

6 years agoministat: disallow negative variance / nan Stddev
emaste [Wed, 21 Feb 2018 15:54:23 +0000 (15:54 +0000)]
ministat: disallow negative variance / nan Stddev

With all values identical it was possible for Var() to return a negative
value due to limited floating point precision, resulting in "nan"
reported as Stddev.

Variance cannot actually be negative, so just return 0.  We can later
investigate alternate algorithms for calculating variance to reduce the
effect of catastrophic cancellation here.

Reported by: Arshan Khanifar <arshankhanifar_gmail.com>
Approved by: phk
Sponsored by: The FreeBSD Foundation

6 years agozdb: raise WARNS from 0 to 2
asomers [Wed, 21 Feb 2018 15:51:48 +0000 (15:51 +0000)]
zdb: raise WARNS from 0 to 2

This has only been possible since r329694 and r329508

MFC after: 3 weeks
X-MFC-With: 329694
X-MFC-With: 329508
Sponsored by: Spectra Logic

6 years agoAdd definition for the PowerPC A2.
nwhitehorn [Wed, 21 Feb 2018 15:15:58 +0000 (15:15 +0000)]
Add definition for the PowerPC A2.

6 years agoAdd definitions for the new Radix MMU mode on POWER9+ CPUs.
nwhitehorn [Wed, 21 Feb 2018 15:15:31 +0000 (15:15 +0000)]
Add definitions for the new Radix MMU mode on POWER9+ CPUs.

6 years agoMFV r329718: 8520 7198 lzc_rollback_to should support rolling back to origin
avg [Wed, 21 Feb 2018 15:12:14 +0000 (15:12 +0000)]
MFV r329718: 8520 7198 lzc_rollback_to should support rolling back to origin

illumos/illumos-gate@95643f75d23914a3e332adc9661ed51749e9858d
https://github.com/illumos/illumos-gate/commit/95643f75d23914a3e332adc9661ed51749e9858d

https://www.illumos.org/issues/8520
  lzc_rollback_to() should support rolling back to a clone's origin.
  The current checks in zfs_ioc_rollback() would not allow that because the
  origin snapshot belongs to a different filesystem.
  The overly restrictive check was introduced in 7600, but it was not a
  regression as none of the existing tools provided a way to rollback to the
  origin.

https://www.illumos.org/issues/7198
  EINVAL is returned when a dataset does not have any snapshots, so there is
  nothing to roll back to.
  Although the code in zfs_do_rollback checks for that condition in advance, it's
  still possible that the snapshot(s) gets removed after the check and before the
  rollback sync task is executed.
  At the moment zfs command would crash when that happens.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Andriy Gapon <avg@FreeBSD.org>
MFC after: 2 weeks

6 years agoMFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue
avg [Wed, 21 Feb 2018 15:07:49 +0000 (15:07 +0000)]
MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue

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

https://www.illumos.org/issues/8997
  When dmu_tx_assign is called from zil_lwb_write_issue, it's possible
  for either ERESTART or EIO to be returned.
  If ERESTART is returned, this will cause an assertion to fail directly
  in zil_lwb_write_issue, where the code assumes the return value is
  EIO if dmu_tx_assign returns a non-zero value. This can occur if the
  SPA is suspended when dmu_tx_assign is called, and most often occurs
  when running zloop.
  If EIO is returned, this can cause assertions to fail elsewhere in the
  ZIL code. For example, zil_commit_waiter_timeout contains the
  following logic:
    lwb_t *nlwb = zil_lwb_write_issue(zilog, lwb);
    ASSERT3S(lwb->lwb_state, !=, LWB_STATE_OPENED);
  In this case, if dmu_tx_assign returned EIO from within
  zil_lwb_write_issue, the lwb variable passed in will not be issued
  to disk. Thus, it's lwb_state field will remain LWB_STATE_OPENED and
  this assertion will fail. zil_commit_waiter_timeout assumes that after
  it calls zil_lwb_write_issue, the lwb will be issued to disk, and
  doesn't handle the case where this is not true; i.e. it doesn't handle
  the case where dmu_tx_assign returns EIO.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>
MFC after: 3 weeks

6 years agolualoader: Use the key that interrupts autoboot as a menu choice
kevans [Wed, 21 Feb 2018 14:37:49 +0000 (14:37 +0000)]
lualoader: Use the key that interrupts autoboot as a menu choice

This matches forth behavior. Hitting "6" when autobooting at the welcome
menu will now take you directly to the "Boot Options" menu.

We likely have some slight optimizations we should make, like not checking
autoboot every time we open a new menu and things of this nature. Further
work will go towards this end.

6 years agoMFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks
avg [Wed, 21 Feb 2018 14:31:48 +0000 (14:31 +0000)]
MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks

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

https://www.illumos.org/issues/8731
  annotate_ecksum() asserts that nui64s, calculated as nui64s = size / sizeof
  (uint64_t), is not greater than UINT16_MAX.
  This restriction is needed because histograms of incorrectly set and cleared
  bits have 16 bit counters and if the buffer consists of too many 64-bit words,
  then a counter can potentially overflow producing an incorrect result.
  When the largest buffer size was 128KB the greatest value of nui64s was 16K,
  well within the limit.
  But now we have support for large buffers and for buffer sizes of 512KB and
  above the restriction is violated.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Andriy Gapon <avg@FreeBSD.org>
MFC after: 2 weeks

6 years agoPowerNV: Put processor to power-save state in idle thread
wma [Wed, 21 Feb 2018 14:28:40 +0000 (14:28 +0000)]
PowerNV: Put processor to power-save state in idle thread

When processor enters power-save state it releases resources shared with other
cpu threads which makes other cores working much faster.

This patch also implements saving and restoring registers that might get
corrupted in power-save state.

Submitted by:          Patryk Duda <pdk@semihalf.com>
Obtained from:         Semihalf
Reviewed by:           jhibbits, nwhitehorn, wma
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14330

6 years agoMFV r329710: 8966 Source file zfs_acl.c, function zfs_aclset_common contains a use...
avg [Wed, 21 Feb 2018 14:17:07 +0000 (14:17 +0000)]
MFV r329710: 8966 Source file zfs_acl.c, function zfs_aclset_common contains a use after end of the lifetime of a local variable

illumos/illumos-gate@82693e09cc02331fa1b3b73b54b1060e73507a8d
https://github.com/illumos/illumos-gate/commit/82693e09cc02331fa1b3b73b54b1060e73507a8d
https://www.illumos.org/issues/8966

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: WHR <msl0000023508@gmail.com>
PR: 225162
Submitted by: WHR <msl0000023508@gmail.com>
Reported by: WHR <msl0000023508@gmail.com>
MFC after: 1 week

6 years agolualoader: Don't autodetect kernels if 'kernels' is explicitly set
kevans [Wed, 21 Feb 2018 14:07:53 +0000 (14:07 +0000)]
lualoader: Don't autodetect kernels if 'kernels' is explicitly set

6 years agoUse proper buffer length (the announce_buf char pointer used to be anarray),
trasz [Wed, 21 Feb 2018 14:05:13 +0000 (14:05 +0000)]
Use proper buffer length (the announce_buf char pointer used to be anarray),
broken in r317143. This fixes those weird "cd0: Attempt" messages at boot.

PR: 222103
Reviewed by: scottl@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14369

6 years agoAllow LinuxKPI character devices to receive mmap() calls from the Linux
hselasky [Wed, 21 Feb 2018 10:13:17 +0000 (10:13 +0000)]
Allow LinuxKPI character devices to receive mmap() calls from the Linux
binary mode user-space emulation layer. This is a regression issue after
r328436, when LinuxKPI character devices started to use DTYPE_DEV in
the "f_type" field of the associated file structure(s).

MFC after: 3 days
Found by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoPowerNV: add missing RTC_WRITE support
wma [Wed, 21 Feb 2018 08:13:17 +0000 (08:13 +0000)]
PowerNV: add missing RTC_WRITE support

Add function which can store RTC values to OPAL.

Submitted by:          Wojciech Macek <wma@semihalf.org>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoCXGBE: implement prefetch on non-Intel architectures
wma [Wed, 21 Feb 2018 08:05:56 +0000 (08:05 +0000)]
CXGBE: implement prefetch on non-Intel architectures

Submitted by:          Michal Stanek <mst@semihalf.com>
Obtained from:         Semihalf
Reviewed by:           np, pdk@semihalf.com
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14452

6 years agolualoader: Allow carousel 'items' to be a table as well as a function
kevans [Wed, 21 Feb 2018 05:04:58 +0000 (05:04 +0000)]
lualoader: Allow carousel 'items' to be a table as well as a function

We don't have any in-tree users of this, but for a static set of carousel
options having to define a callback is excessive.

6 years agolualoader: Simplify menu definitions a little further
kevans [Wed, 21 Feb 2018 04:48:37 +0000 (04:48 +0000)]
lualoader: Simplify menu definitions a little further

Allow "name" entries to be simple strings, instead of just functions. We
know whether we support colors or not by the time any of this is setup, so
all menu names that are basically static with colors sprinkled in are good
candidates for simplification.

Also simplify "func" in many cases where it's just invoking another function
with no arguments. The downside to this simplification is that the functions
called can no longer be trivially replaced by a local module. The upside is
that it removes another layer of indirection that we likely don't need.

These can be re-evaluated later if a compelling argument is raised, on a
case-by-case basis, for replacement.

6 years agolualoader: Directly reference submenu definition with submenu key
kevans [Wed, 21 Feb 2018 04:23:13 +0000 (04:23 +0000)]
lualoader: Directly reference submenu definition with submenu key

6 years agolualoader: Drop name requirement for menu separators
kevans [Wed, 21 Feb 2018 04:14:32 +0000 (04:14 +0000)]
lualoader: Drop name requirement for menu separators

6 years agolualoader: Add "menu.default", initialized to menu.welcome
kevans [Wed, 21 Feb 2018 03:37:46 +0000 (03:37 +0000)]
lualoader: Add "menu.default", initialized to menu.welcome

The intent here is to abstract away the name of the default menu. The
default menu is still the welcome menu, but this detail doesn't need to
matter to things outside of the menu module. You may change the default
menu, but one would need to modify a specific menu.

6 years agoSplit printtrap() into generic and CPU-specific components
jhibbits [Wed, 21 Feb 2018 03:34:33 +0000 (03:34 +0000)]
Split printtrap() into generic and CPU-specific components

Summary:
This compartmentalizes the CPU-specific trap components into its own
function, rather than littering the general printtrap() with various checks.
This will let us replace a series of #ifdef's with a runtime conditional check
in the future.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D14416

6 years agoMFV r324198: 8081 Compiler warnings in zdb
mav [Wed, 21 Feb 2018 03:08:47 +0000 (03:08 +0000)]
MFV r324198: 8081 Compiler warnings in zdb

illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c
https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c

https://www.illumos.org/issues/8081
  zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD,
  which uses -WError, the only way to build it is to disable all compiler
  warnings. This makes it much harder to detect newly introduced bugs. We should
  cleanup all the warnings.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Alan Somers <asomers@gmail.com>

6 years agolualoader: Return only argstr if with_kernel not requested
kevans [Wed, 21 Feb 2018 03:06:36 +0000 (03:06 +0000)]
lualoader: Return only argstr if with_kernel not requested

6 years agolualoader: Bring in local.lua module if it exists
kevans [Wed, 21 Feb 2018 02:35:13 +0000 (02:35 +0000)]
lualoader: Bring in local.lua module if it exists

Provide a way for out-of-tree users of lualoader to patch into the loader
system without having to modify our distributed scripts.

Do note that we can't really offer any API compatibility guarantees at this
time due to the evolving nature of lualoader right now.

This still has some utility as local modules may add commands at the loader
prompt without relying heavily on lualoader features- this specific
functionality is less likely to change without more careful consideration.

Reviewed by: cem (earlier version)
Differential Revision: https://reviews.freebsd.org/D14439

6 years agoMFV r322231:
mav [Wed, 21 Feb 2018 02:21:22 +0000 (02:21 +0000)]
MFV r322231:
8430 dir_is_empty_readdir() doesn't properly handle error from fdopendir()

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

https://www.illumos.org/issues/8430
  we should close dirfd if fdopendir() fails.

Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Sowrabha Gopal <sowrabha.gopal@delphix.com>

6 years agoMFV r319737: 6939 add sysevents to zfs core for commands
mav [Wed, 21 Feb 2018 02:19:42 +0000 (02:19 +0000)]
MFV r319737: 6939 add sysevents to zfs core for commands

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

https://www.illumos.org/issues/6939
  Originally created https://smartos.org/bugview/OS-4489
       sysevents should be fired in the kernel from ZFS whenever a command
       is run that is logged in zpool history.
  Example output
  Terminal 1
  root - gz sunos ~ # zfs create zones/foobar
  root - gz sunos ~ # zfs set quota=10g zones/foobar
  root - gz sunos ~ # zfs destroy zones/foobar
  Terminal 2
  root - gz sunos ~ # sysevent EC_zfs
  nvlist version: 0
      date = 2016-04-28T14:50:08.964Z
      vendor = SUNW
      publisher = zfs
      class = EC_zfs
      subclass = ESC_ZFS_history_event
      pid = 0
      data = (embedded nvlist)
      nvlist version: 0
          pool_name = zones
          pool_guid = 0x40c964e8f9a7a694
          history_record = (embedded nvlist)
          nvlist version: 0
              dsname = zones/foobar
              dsid = 0x1525
              history internal str =
              internal_name = create
              history txg = 0x4c4ef3

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Josh Wilsdon <jwilsdon@joyent.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Alan Somers <asomers@gmail.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Dave Eddy <dave@daveeddy.com>

6 years agolualoader: Output "Failed to parse" messages
kevans [Wed, 21 Feb 2018 01:52:42 +0000 (01:52 +0000)]
lualoader: Output "Failed to parse" messages

I can't find any good reason these aren't enabled, so enable them.

The silent runs will only return false on actual parse errors, so it's ok to
be loud about those failures.

6 years agolualoader: Don't return false for failure to open config on silent parse
kevans [Wed, 21 Feb 2018 01:50:46 +0000 (01:50 +0000)]
lualoader: Don't return false for failure to open config on silent parse

6 years agolualoader: Drop explicit boolean tests; b or not b
kevans [Wed, 21 Feb 2018 01:39:33 +0000 (01:39 +0000)]
lualoader: Drop explicit boolean tests; b or not b

6 years agostyle.lua(9): Drop notes about semicolons
kevans [Wed, 21 Feb 2018 01:37:22 +0000 (01:37 +0000)]
style.lua(9): Drop notes about semicolons

It is generally agreed upon that they are ugly and should not be used except
where needed.

6 years agolualoader: Drop excessive parenthesizing
kevans [Wed, 21 Feb 2018 01:35:19 +0000 (01:35 +0000)]
lualoader: Drop excessive parenthesizing

This was also a convenience convention (for me) that is not very lua-tic.
Drop it.

I've maintained some parentheses where I'd prefer them, for example,
'if x or y or (z and w) then', but these situations are far and few between.

6 years agolualoader: Drop terminating semicolons
kevans [Wed, 21 Feb 2018 01:10:03 +0000 (01:10 +0000)]
lualoader: Drop terminating semicolons

This was previously chosen out of convenience, as we had a mixed style and
needed to be consistent. I started learning Lua on Friday, so I switched
everything over. It is not a very lua-nic convention, though, so drop it.

Excessive parenthesizing around conditionals is next on the chopping block.

6 years agoMFV r319736: 6396 remove SVM
mav [Wed, 21 Feb 2018 00:24:54 +0000 (00:24 +0000)]
MFV r319736: 6396 remove SVM

illumos/illumos-gate@5f10ef697f250374b7b917e10961c4e02d4e3112
https://github.com/illumos/illumos-gate/commit/5f10ef697f250374b7b917e10961c4e02d4e3112

https://www.illumos.org/issues/6396
  LVM = SVM = Solaris Volume Manager
  dead code and not using with ZFS based platform.

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

6 years agomountd: Return proper errno values in a few error paths
rpokala [Wed, 21 Feb 2018 00:19:02 +0000 (00:19 +0000)]
mountd: Return proper errno values in a few error paths

When attempting to mount a non-directory which exists, return ENOTDIR instead
of ENOENT. If stat() or statfs() failed, don't pass part of the invalid
(struct statfs) to ex_search(). In that same case, preserve the value of "bad"
rather than overwriting with EACCES.

Submitted by: Bruce Leverett (Panasas)
Reviewed by: rmacklem
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D14438

6 years agoMFV r318941: 7446 zpool create should support efi system partition
mav [Wed, 21 Feb 2018 00:18:57 +0000 (00:18 +0000)]
MFV r318941: 7446 zpool create should support efi system partition

illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821
https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821

https://www.illumos.org/issues/7446
  Since we support whole-disk configuration for boot pool, we also will need
  whole disk support with UEFI boot and for this, zpool create should create efi-
  system partition.
  I have borrowed the idea from oracle solaris, and introducing zpool create -
  B switch to provide an way to specify that boot partition should be created.
  However, there is still an question, how big should the system partition be.
  For time being, I have set default size 256MB (thats minimum size for FAT32
  with 4k blocks). To support custom size, the set on creation "bootsize"
  property is created and so the custom size can be set as: zpool create B -
  o bootsize=34MB rpool c0t0d0
  After pool is created, the "bootsize" property is read only. When -B switch is
  not used, the bootsize defaults to 0 and is shown in zpool get output with
  value ''. Older zfs/zpool implementations are ignoring this property.
  https://www.illumos.org/rb/r/219/

Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Approved by: Dan McDonald <danmcd@kebe.com>
Author: Toomas Soome <tsoome@me.com>

This commit makes no sense for FreeBSD, that is why I blocked the option,
but it should be good to stay closer to upstream.

6 years agolualoader: When restoring environment, only restore unchanged vars
kevans [Tue, 20 Feb 2018 22:47:49 +0000 (22:47 +0000)]
lualoader: When restoring environment, only restore unchanged vars

Track the latest value we've set an environment variable to, and only
restore those that are unchanged from that.

This gives us some leeway to make sure we're not clobbering variables
overwritten by menu changes.

6 years agoProperly lookup values if they were empty.
bdrewery [Tue, 20 Feb 2018 22:03:08 +0000 (22:03 +0000)]
Properly lookup values if they were empty.

Spotted by: rpokala
X-MFC-With: r329676
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoOnly lookup SVN once and rename to SVN_CMD.
bdrewery [Tue, 20 Feb 2018 22:03:04 +0000 (22:03 +0000)]
Only lookup SVN once and rename to SVN_CMD.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoAvoid looking up VCS_REVISION for every sub-make call to Makefile.inc1.
bdrewery [Tue, 20 Feb 2018 21:53:39 +0000 (21:53 +0000)]
Avoid looking up VCS_REVISION for every sub-make call to Makefile.inc1.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoMove SVNVERSION_CMD into the one place that uses it.
bdrewery [Tue, 20 Feb 2018 21:48:16 +0000 (21:48 +0000)]
Move SVNVERSION_CMD into the one place that uses it.

This code, which is basically `svnversion || svnliteversion`, generates
2 fstatat(2) for every directory in PATH for every Makefile parsed that
includes bsd.own.mk.  This can add up for things like generating a Ports
index (Poudriere) or building a dependency graph for base.

Sponsored by: Dell EMC
MFC after: 2 weeks

6 years agoCatch up with the removal of nktr_slot_flags from upstream netmap. No
np [Tue, 20 Feb 2018 21:42:45 +0000 (21:42 +0000)]
Catch up with the removal of nktr_slot_flags from upstream netmap.  No
functional impact intended.

Submitted by: Vincenzo Maffione <v.maffione@gmail.com>

6 years agolualoader: Intercept the 'autoboot' cli command
kevans [Tue, 20 Feb 2018 21:37:55 +0000 (21:37 +0000)]
lualoader: Intercept the 'autoboot' cli command

6 years agolualoader: Intercept boot cli command
kevans [Tue, 20 Feb 2018 21:32:36 +0000 (21:32 +0000)]
lualoader: Intercept boot cli command

This should be functional and roughly equivalent to the Forth version.

Stop doing a loadelf() on menu exit now that we can DTRT with boot
invocations. autoboot interception will follow not long after.

6 years agoFix the broken subqueue assignment for the cleanq.
jeff [Tue, 20 Feb 2018 21:27:17 +0000 (21:27 +0000)]
Fix the broken subqueue assignment for the cleanq.

Reported by: pho
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon

6 years agolualoader: Prepare for interception of "boot" CLI cmd
kevans [Tue, 20 Feb 2018 21:23:01 +0000 (21:23 +0000)]
lualoader: Prepare for interception of "boot" CLI cmd

core.boot and core.autoboot may both take arguments; add a helper to cleanly
append an argstring to the given loader command.

Also provide a popFrontTable() that we'll use pop the command name off of an
argv table. We don't have the table library included, and including it is
non-trivial, so we'll implement this one function that we need in lua for
the time being.

6 years agolualoader: Don't try so hard to load a kernel
kevans [Tue, 20 Feb 2018 21:15:43 +0000 (21:15 +0000)]
lualoader: Don't try so hard to load a kernel

If the user's selected a kernel, we really should be trying to load that one
instead of falling back to some default kernel.

This should generally be a no-op and most desirable, unless you really
enjoyed surprises.

6 years agolualoader: Prefer selected kernel to currently loaded
kevans [Tue, 20 Feb 2018 21:13:21 +0000 (21:13 +0000)]
lualoader: Prefer selected kernel to currently loaded

6 years agoMFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup()
mav [Tue, 20 Feb 2018 20:46:27 +0000 (20:46 +0000)]
MFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup()

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

https://www.illumos.org/issues/7990
  The snapspec_cb() callback function in libzfs does not need to call zfs_strdup().

Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Marcel Telka <marcel@telka.sk>

6 years agoMFV r316902: 7745 print error if lzc_* is called before libzfs_core_init
mav [Tue, 20 Feb 2018 20:40:55 +0000 (20:40 +0000)]
MFV r316902: 7745 print error if lzc_* is called before libzfs_core_init

illumos/illumos-gate@7c13517fff71be473e47531ef4330160c042bedc
https://github.com/illumos/illumos-gate/commit/7c13517fff71be473e47531ef4330160c042bedc

https://www.illumos.org/issues/7745
  The problem is that consumers of `libZFS_Core` that forget to call
  `libzfs_core_init()` before calling any other function of the library
  are having a hard time realizing their mistake. The library's internal
  file descriptor is declared as global static, which is ok, but it is not
  initialized explicitly; therefore, it defaults to 0, which is a valid
  file descriptor. If `libzfs_core_init()`, which explicitly initializes
  the correct fd, is skipped, the ioctl functions return errors that do
  not have anything to do with `libZFS_Core`, where the problem is
  actually located.
  Even though assertions for that existed within `libZFS_Core` for debug
  builds, they were never enabled because the `-DDEBUG` flag was missing
  from the compiler flags.
  This patch applies the following changes:
  1. It adds `-DDEBUG` for debug builds of `libZFS_Core` and `libzfs`,
         to enable their assertions on debug builds.
  2. It corrects an assertion within `libzfs`, where a function had
         been spelled incorrectly (`zpool_prop_unsupported()`) and nobody
         knew because the `-DDEBUG` flag was missing, and the preprocessor
         was taking that part of the code away.
  3. The library's internal fd is initialized to `-1` and `VERIFY`
         assertions have been placed to check that the fd is not equal to
         `-1` before issuing any ioctl. It is important here to note, that
         the `VERIFY` assertions exist in both debug and non-debug builds.
  4. In `libzfs_core_fini` we make sure to never increment the
         refcount of our fd below 0, and also reset the fd to `-1` when no
         one refers to it. The reason for this, is for the rare case that
         the consumer closes all references but then calls one of the
         library's functions without using `libzfs_core_init()` first, and
         in the mean time, a previous call to `open()` decided to reuse
         our previous fd. This scenario would have passed our assertion in

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>

6 years agomtx: add debug assertions to mtx_spin_wait_unlocked
mjg [Tue, 20 Feb 2018 20:39:34 +0000 (20:39 +0000)]
mtx: add debug assertions to mtx_spin_wait_unlocked

6 years agoMFV r316901:
mav [Tue, 20 Feb 2018 20:37:01 +0000 (20:37 +0000)]
MFV r316901:
7730 libzfs`add_config() leaks config nvl when reading spare/l2cache devices

illumos/illumos-gate@105686550ee9cbf5d033166a8a2a5a763667d436
https://github.com/illumos/illumos-gate/commit/105686550ee9cbf5d033166a8a2a5a763667d436

https://www.illumos.org/issues/7730
  antares:root:~# mdb /usr/sbin/zpool
  > ::sysbp _exit
  > ::run import
     pool: data
       id: 2093977168778024605
    state: ONLINE
   action: The pool can be imported using its name or numeric identifier.
   config:

          data        ONLINE
            c6t0d0    ONLINE
            c6t1d0    ONLINE
          cache
            c6t2d0
  mdb: stop on entry to _exit
  mdb: target stopped at:
  0xfee556ba:     nop
  mdb: You've got symbols!
  Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1
  libnvpair.so.1 ]
  > ::findleaks -d
  BYTES             LEAKED VMEM_SEG CALLER
  4096                  10 fda7b000 MMAP
  8192                   1 fea8d000 MMAP
  8192                   1 fe76d000 MMAP
  8192                   1 fe66e000 MMAP
  4096                   1 fe570000 MMAP
  8192                   1 fe470000 MMAP
  4096                   1 fe372000 MMAP
  4096                   1 fe273000 MMAP

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

6 years agoMFV r316893:
mav [Tue, 20 Feb 2018 20:34:04 +0000 (20:34 +0000)]
MFV r316893:
7604 if volblocksize property is the default, it displays as "-" rather than 8K

illumos/illumos-gate@4d86c0eab246bdfddc2dd52410ba808433bd6266
https://github.com/illumos/illumos-gate/commit/4d86c0eab246bdfddc2dd52410ba808433bd6266

https://www.illumos.org/issues/7604
  If a zvol has the default setting for the "volblocksize" property, it is
  8KB. However, it is displayed as "-" (not present), rather than "8K".
  The problem was introduced by:
  commit 25228e830e86924a41243343b1de9daf2d7dd43a
      Author: Matthew Ahrens &lt;mahrens@delphix.com&gt;
      Date:   Thu Nov 17 14:37:24 2016 -0800
  7571 non-present readonly numeric ZFS props do not have default value
  which changed changed get_numeric_property() to indicate that readonly
  default properties are not present. However, zfs_prop_readonly() returns
  TRUE for both readonly and set-once properties (e.g. volblocksize).
  Amusingly, that commit essentially reverted:
  6900484 default volblocksize is no longer being reported correctly
  from November 2009. However, that change was not correct either; the
  correct solution is to only do this check for "truly readonly" (i.e. not
  setonce) properties.
  $ zfs list -t volume -o name,volblocksize
      NAME
  VOLBLOCK
      domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/
  archive            -
      domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/
  datafile           -
      domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/
  external           -
      rpool/dump
  128K
      rpool/swap
  4K
      rpool/swap1
  ===============================================================================

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

6 years agoMFV r316876: 7542 zfs_unmount failed with EZFS_UNSHARENFSFAILED
mav [Tue, 20 Feb 2018 20:30:40 +0000 (20:30 +0000)]
MFV r316876: 7542 zfs_unmount failed with EZFS_UNSHARENFSFAILED

illumos/illumos-gate@09c9e6dc9b69d10b771bb87e01040ec320a0bfd3
https://github.com/illumos/illumos-gate/commit/09c9e6dc9b69d10b771bb87e01040ec320a0bfd3

https://www.illumos.org/issues/7542
  libshare keeps a cached copy of the sharetab listing in memory, which can
  become out of date if shares are destroyed or created while leaving a libzfs
  handle open. This results in a spurious unmounting failure when an NFS share
  exists but isn't in the stale libshare cache.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Amdur <matt.amdur@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chris Williamson <chris.williamson@delphix.com>

6 years agolualoader: Replace invalid construct with valid construct
kevans [Tue, 20 Feb 2018 20:29:41 +0000 (20:29 +0000)]
lualoader: Replace invalid construct with valid construct

It only worked by coincidence, but it did work. Store varargs in a table
instead and work off of that.

6 years agoMFV r316875: 7336 vfork and O_CLOEXEC causes zfs_mount EBUSY
mav [Tue, 20 Feb 2018 20:26:48 +0000 (20:26 +0000)]
MFV r316875: 7336 vfork and O_CLOEXEC causes zfs_mount EBUSY

illumos/illumos-gate@873c4903a52d089cd8234b79d24f5a3fc3bccc82
https://github.com/illumos/illumos-gate/commit/873c4903a52d089cd8234b79d24f5a3fc3bccc82

https://www.illumos.org/issues/7336
  We can run into a problem where we call into zfs_mount, which in turn calls
  is_dir_empty, which opens the directory to try and make sure it's empty. The
  issue with the current approach is that it holds the directory open while it
  traverses it with readdir, which, due to subtle interaction with the Java JVM,
  vfork, and exec can cause a tricky race condition resulting in zfs_mount
  failures.
  The approach to resolving the issue in this patch is to drop the usage of
  readdir altogether, and instead rely on the fact that ZFS stores the number of
  entries contained in a directory using the st_size field of the stat structure.
  Thus, if the directory in question is a ZFS directory, we can check to see if
  it's empty by calling stat() and inspecting the st_size field of structure
  returned.
  ===============================================================================
  The root cause appears to be an interesting race between vfork, exec, and
  zfs_mount's usage of O_CLOEXEC when calling openat. Here's what is going on:
  1. We call zfs_mount, and this in turn calls openat to check if the directory
  is empty, which results in opening the directory we're trying to mount onto,
  and increment v_count.
  2. As we're in the middle of reading the directory, vfork is called by the JVM
  and proceeds to exec the jspawnhelper utility. As a result of the vfork, we
  take an additional hold on the directory, which increments v_count a second
  time. The semantics of vfork mean the parent process will wait for the child
  process to exit or exec before the parent can continue; at this point the
  parent is in the middle of zfs_mount, reading the directory to determine if
  it's empty or not.
  3. The child process exec-ing jspawnhelper gets to the relvm call within
  exec_args (which is called by exec_common). relvm is the function that releases
  the parent process, allowing the parent to proceed. The problem is, at this
  point of calling relvm, the child hasn't yet called close_exec which is
  responsible for closing the file descriptors inherited from the parent process

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>

6 years agoFix reaping on process fd close broken after r329449
mjg [Tue, 20 Feb 2018 20:19:38 +0000 (20:19 +0000)]
Fix reaping on process fd close broken after r329449

The only consumer of proc_reap other than proc_to_reap was not updated
to not PROC_SLOCK.

Reported by:    Juan Ramon Molina Menor <listjm club.fr>

6 years agoMFV r316873: 7233 dir_is_empty should open directory with CLOEXEC
mav [Tue, 20 Feb 2018 20:17:19 +0000 (20:17 +0000)]
MFV r316873: 7233 dir_is_empty should open directory with CLOEXEC

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

https://www.illumos.org/issues/7233
  This fixes a race where one thread is executing zfs_mount() while another
  thread forks and execs. If the fork occurs while the directory is open, the
  child process will inherit (but not necessarily close immediately) the open fd
  for the directory, preventing the mount.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Alex Reece <alex@delphix.com>

6 years agoMFV r316872: 7502 ztest should run zdb with -G (debug mode)
mav [Tue, 20 Feb 2018 20:14:11 +0000 (20:14 +0000)]
MFV r316872: 7502 ztest should run zdb with -G (debug mode)

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

https://www.illumos.org/issues/7502
  Right now ztest executes zdb without -G, so when it has errors, the messages
  are often not very helpful:
  Executing zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest
  zdb: can't open 'ztest': Operation not supported
  ztest: '/usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest' exit
  code 1
  With -G, we'd have:
  /usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache -G ztest
  zdb: can't open 'ztest': Operation not supported

  ZFS_DBGMSG(zdb):
  spa_open_common: opening ztest
  spa_load(ztest): LOADING
  spa_load(ztest): FAILED: unable to parse config [error=48]
  spa_load(ztest): UNLOADING
  Which indicates where the error came from

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

6 years agoFix memory leaks in zdb introduced by r329508
asomers [Tue, 20 Feb 2018 19:54:06 +0000 (19:54 +0000)]
Fix memory leaks in zdb introduced by r329508

Reported by: Coverity
CID: 1386185
MFC after: 3 weeks
X-MFC-With: 329508
Sponsored by: Spectra Logic Corp

6 years agoloader.lua: Expose errno table to lua
cem [Tue, 20 Feb 2018 19:39:48 +0000 (19:39 +0000)]
loader.lua: Expose errno table to lua

Reviewed by: kevans
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14454

6 years agolualoader: Ignore ACPI bits on !i386
kevans [Tue, 20 Feb 2018 19:21:34 +0000 (19:21 +0000)]
lualoader: Ignore ACPI bits on !i386

6 years agoIFLIB: do not remove dmamap on buffer unload
shurd [Tue, 20 Feb 2018 18:33:45 +0000 (18:33 +0000)]
IFLIB: do not remove dmamap on buffer unload

Dmamap is created only on IFC attach. If we remove it on
buffer release, we won't be able to do ifconfig down&up. Only destroy
when in detach.

Reported by: wma
Reviewed by: wma
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14060

6 years agoliblua: Add loader.machine and loader.machine_arch properties
kevans [Tue, 20 Feb 2018 18:24:20 +0000 (18:24 +0000)]
liblua: Add loader.machine and loader.machine_arch properties

Provisioned from MACHINE/MACHINE_ARCH on the system, expose loader.machine
and loader.machine_arch respectively.

These may be used to hide ACPI option on non-applicable archs.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14446

6 years agoLua lfs.attributes: Provide a more consistent error return
cem [Tue, 20 Feb 2018 18:21:30 +0000 (18:21 +0000)]
Lua lfs.attributes: Provide a more consistent error return

In the remaining error case, return a 3-tuple consistent with the other
error return case.

Document how to invoke lfs.attributes() and detect/decode error return in
example comments.

Reviewed by: kevans
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14451

6 years agoReduce duplication in dynamic syscall registration code.
brooks [Tue, 20 Feb 2018 18:08:57 +0000 (18:08 +0000)]
Reduce duplication in dynamic syscall registration code.

Remove the unused syscall_(de)register() functions in favor of the
better documented and easier to use syscall_helper_(un)register(9)
functions.

The default and freebsd32 versions differed in which array of struct
sysents they used and a few missing updates to the 32-bit code as
features were added to the main code.

Reviewed by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14337

6 years agolualoader: Eliminate global namespace pollution in loader.lua
kevans [Tue, 20 Feb 2018 18:05:21 +0000 (18:05 +0000)]
lualoader: Eliminate global namespace pollution in loader.lua

6 years agolualoader: Move carousel storage out into config
kevans [Tue, 20 Feb 2018 18:04:08 +0000 (18:04 +0000)]
lualoader: Move carousel storage out into config

Carousel storage doesn't need to happen in the menu module, and indeed
storing it there introduces a circular reference between drawer and menu
that only works because of global pollution in loader.lua.

Carousel choices generally map to config entries anyways, making it as good
of place as any to store these. Move {get,set}CarouselIndex functionality
out into config so that drawer and menu may both use it. If we had more
carousel functionality, it might make sense to create a carousel module, but
this is not the case.

6 years agolualoader: Add ability to intercept cli commands
kevans [Tue, 20 Feb 2018 17:46:50 +0000 (17:46 +0000)]
lualoader: Add ability to intercept cli commands

If we failed to execute the input line as pure lua, run the command through
parse for consistent argument parsing. Pass the parsed arguments through to
a global "cli_execute" written in Lua, which is expected to either handle it
or pass it back through to interp_builtin_cmd (via loader.command).

lua-handled cli commands will then exist as globals in whatever module they
most belong in, and invocations at the loader prompt will magically dispatch
to them if they exist.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14450

6 years agoImplement loader.command
imp [Tue, 20 Feb 2018 17:28:59 +0000 (17:28 +0000)]
Implement loader.command

This is just like loader.perform, except it takes pre-parsed arguments.

Review: https://reviews.freebsd.org/D14448

6 years agoAdjust whitespace of things added in the past couple years to match the
ian [Tue, 20 Feb 2018 14:59:29 +0000 (14:59 +0000)]
Adjust whitespace of things added in the past couple years to match the
original style of the file.  No functional changes.

6 years agostand/lua: Consistently organize modules
kevans [Tue, 20 Feb 2018 14:45:58 +0000 (14:45 +0000)]
stand/lua: Consistently organize modules

We follow pretty closely the following structure of a module:

1. Copyright notice
2. Module requires
3. Module local declarations
4. Module local definitions
5. Module exports
6. return

Re-organize the one-offs (config/drawer) and denote the start of module
exports with a comment.

6 years agostand/lua: Consistently declare local functions at module scope
kevans [Tue, 20 Feb 2018 14:36:28 +0000 (14:36 +0000)]
stand/lua: Consistently declare local functions at module scope

Declare these adjacent to the local definitions at the top of the module,
and make sure they're actually declared local to pollute global namespace a
little bit less.

6 years agoMake killpg1 perform process validity checks without proc lock held.
mjg [Tue, 20 Feb 2018 10:52:07 +0000 (10:52 +0000)]
Make killpg1 perform process validity checks without proc lock held.

6 years agovm_wait() rework.
kib [Tue, 20 Feb 2018 10:13:13 +0000 (10:13 +0000)]
vm_wait() rework.

Make vm_wait() take the vm_object argument which specifies the domain
set to wait for the min condition pass.  If there is no object
associated with the wait, use curthread' policy domainset.  The
mechanics of the wait in vm_wait() and vm_wait_domain() is supplied by
the new helper vm_wait_doms(), which directly takes the bitmask of the
domains to wait for passing min condition.

Eliminate pagedaemon_wait().  vm_domain_clear() handles the same
operations.

Eliminate VM_WAIT and VM_WAITPFAULT macros, the direct functions calls
are enough.

Eliminate several control state variables from vm_domain, unneeded
after the vm_wait() conversion.

Scetched and reviewed by: jeff
Tested by: pho
Sponsored by: The FreeBSD Foundation, Mellanox Technologies
Differential revision: https://reviews.freebsd.org/D14384

6 years agoPowerPC: Switch to more accurate unit to avoid division rounding
wma [Tue, 20 Feb 2018 07:30:57 +0000 (07:30 +0000)]
PowerPC: Switch to more accurate unit to avoid division rounding

On POWER8 architecture there is a timer with 512Mhz frequency.
It has about 1,95ns period, but it is rounded to 1ns which is not accurate.

Submitted by:          Patryk Duda <pdk@semihalf.com>
Obtained from:         Semihalf
Reviewed by:           wma
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14433

6 years agoPowerNV: Send SIGILL on HEA illegal instruction exception
wma [Tue, 20 Feb 2018 06:38:55 +0000 (06:38 +0000)]
PowerNV: Send SIGILL on HEA illegal instruction exception

Currently Hypervisor Emulation Assistance interrupt is unhandled.
Executing an undefined instruction in userland triggers kernel panic.
Handle this the same way as Facility Unavailable Interrupt - send
SIGILL signal to userspace.

Submitted by:          Michal Stanek <mst@semihalf.com>
Obtained from:         Semihalf
Reviewed by:           nwhitehorn, pdk@semihalf.com, wma
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14437

6 years agoMore verbose output.
imp [Tue, 20 Feb 2018 05:35:00 +0000 (05:35 +0000)]
More verbose output.

6 years agostyle.lua(9): Clarify local variable guideline
kevans [Tue, 20 Feb 2018 05:21:58 +0000 (05:21 +0000)]
style.lua(9): Clarify local variable guideline

The intent of this guideline is to avoid creating global variables in module
scope. Its main purpose is to serve as a reminder that variables at module
scope also need to be declared.

We want to avoid global variables in general, but this is easier to mess up
when designing things in the module scope.

6 years agostand/lua: Insert helpful comment for drawer.branddefs
kevans [Tue, 20 Feb 2018 05:12:39 +0000 (05:12 +0000)]
stand/lua: Insert helpful comment for drawer.branddefs

6 years agostand/lua: Stick a copyright notice on drawer.lua
kevans [Tue, 20 Feb 2018 05:11:24 +0000 (05:11 +0000)]
stand/lua: Stick a copyright notice on drawer.lua

6 years agostand/lua: Use 'graphic' instead of 'logo' for table depicting graphics
kevans [Tue, 20 Feb 2018 05:10:26 +0000 (05:10 +0000)]
stand/lua: Use 'graphic' instead of 'logo' for table depicting graphics

This is a more sensible name that offers less redundancy when referring to
it (vs. logodef.logo). Switch to it while the getting is good.

6 years agoMFC r316910: 7812 Remove gender specific language
mav [Tue, 20 Feb 2018 05:07:21 +0000 (05:07 +0000)]
MFC r316910: 7812 Remove gender specific language

illumos/illumos-gate@48bbca816818409505a6e214d0911fda44e622e3
https://github.com/illumos/illumos-gate/commit/48bbca816818409505a6e214d0911fda44e622e3

https://www.illumos.org/issues/7812
  This change removes all gendered language that did not refer specifically
  to an individual person or pet. The convention taken was to use
  variations on "they" when referring to users and/or human beings, while
  using "it" when referring to code, functions, and/or libraries.
  Additionally, we took the liberty to fix up any whitespace issues that
  were found in any files that were already being modified.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Chris Williamson <chris.williamson@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Daniel Hoffman <dj.hoffman@delphix.com>

6 years agostand/lua: Refactor brands into drawer.branddefs
kevans [Tue, 20 Feb 2018 05:06:11 +0000 (05:06 +0000)]
stand/lua: Refactor brands into drawer.branddefs

6 years agostand/lua: Refactor logos into drawer.logodefs table
kevans [Tue, 20 Feb 2018 04:56:03 +0000 (04:56 +0000)]
stand/lua: Refactor logos into drawer.logodefs table

This refactor makes it straightforward to add new logos for drawing and
organizes logo definitions in a logical manner.

The graphic to be drawn for each logo may again be modified outside of
drawer, but it must be done on a case-by-case basis as a modification to the
loader_logo.

6 years agoMFV r307315:
mav [Tue, 20 Feb 2018 04:36:51 +0000 (04:36 +0000)]
MFV r307315:
7301 zpool export -f should be able to interrupt file freeing

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Author: Alek Pinchuk <alek@nexenta.com>

Closes #175

6 years agostand/lua: Reduce exposure of the drawer module
kevans [Tue, 20 Feb 2018 04:23:43 +0000 (04:23 +0000)]
stand/lua: Reduce exposure of the drawer module

As part of an effort to slowly reduce our exports overall to a set of stable
properties/functions, go ahead and reduce what drawer exposes to others.

The graphics should generally not be modified on their own, but their
position could be modified if additional grahics also need to be drawn.
Export position/shift information, but leave the actual graphic local to
the module.

The next step will be to create a 'menudef' that gets exported instead, with
each entry in the menudef table describing the graphic to be drawn along
with specific positioning information.

6 years agoMFV r302649: 7016 arc_available_memory is not 32-bit safe
mav [Tue, 20 Feb 2018 04:14:12 +0000 (04:14 +0000)]
MFV r302649: 7016 arc_available_memory is not 32-bit safe

illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190
https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190

https://www.illumos.org/issues/7016
  upstream DLPX-39446 arc_available_memory is not 32-bit safe
  https://github.com/delphix/delphix-os/commit/
  6b353ea3b8a1610be22e71e657d051743c64190b
  related to this upstream:
  DLPX-38547 delphix engine hang
  https://github.com/delphix/delphix-os/commit/
  3183a567b3e8c62a74a65885ca60c86f3d693783
  DLPX-38547 delphix engine hang (fix static global)
  https://github.com/delphix/delphix-os/commit/
  22ac551d8ef085ad66cc8f65e51ac372b12993b9
  DLPX-38882 system hung waiting on free segment
  https://github.com/delphix/delphix-os/commit/
  cdd6beef7548cd3b12f0fc0328eeb3af540079c2

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
Author: Prakash Surya <prakash.surya@delphix.com>

6 years agostand/lua: Move drawer.menu_name_handlers further up
kevans [Tue, 20 Feb 2018 04:11:48 +0000 (04:11 +0000)]
stand/lua: Move drawer.menu_name_handlers further up

As a good candidate for modification, move this table further up in the
module to improve visibility.

6 years agostand/lua: Add and use drawer.menu_name_handlers
kevans [Tue, 20 Feb 2018 03:58:45 +0000 (03:58 +0000)]
stand/lua: Add and use drawer.menu_name_handlers

Pull out specialized naming behavior into drawer.menu_name_handlers. This is
currently only needed for the carousel entry, where naming is based on the
current choice and the menu item purposefully does not store this state.

The setup was designed so that every type can have a special name handler,
and the default action is to simply use the result of entry.name().

6 years agoAdd missing MODULE_DEPENDS().
ian [Tue, 20 Feb 2018 03:51:09 +0000 (03:51 +0000)]
Add missing MODULE_DEPENDS().

6 years agostand/lua: Extract menu handlers out into menu.handlers table
kevans [Tue, 20 Feb 2018 03:40:16 +0000 (03:40 +0000)]
stand/lua: Extract menu handlers out into menu.handlers table

This is a bit cleaner than our former method of an if ... else chain of
handlers. Store handlers in the menu.handlers table so that they may be
added to or removed dynamically.

All handlers take the current menu and selected entry as parameters, and
their return value indicates whether the menu processor should continue or
not. An omitted return value or 'true' will indicate that we should
continue, while returning 'false' will indicate that we should exit the
current menu.

The omitted return value behavior is due to continuing the loop being the
more common situation.

6 years agoReduce contention on the proctree lock during heavy package build.
mjg [Tue, 20 Feb 2018 02:18:30 +0000 (02:18 +0000)]
Reduce contention on the proctree lock during heavy package build.

There is a proctree -> allproc ordering established.

Most of the time it is either xlock -> xlock or slock -> slock.

On fork however there is a slock -> xlock pair which results in
pathological wait times due to threads keeping proctree held for
reading and all waiting on allproc. Switch this to xlock -> xlock.
Longer term fix would get rid of proctree in this place to begin with.
Right now it is necessary to walk the session/process group lists to
determine which id is free. The walk can be avoided e.g. with bitmaps.

The exit path used to have one place which dealt with allproc and
then with proctree. Move the allproc acquire into the section protected
by proctree. This reduces contention against threads waiting on proctree
in the fork codepath - the fork proctree holder does not have to wait
for allproc as often.

Finally, move tidhash manipulation outside of the area protected by
either of these locks. The removal from the hash was already unprotected.
There is no legitimate reason to look up thread ids for a process still
under construction.

This results in about 50% wait time reduction during -j 128 package build.

6 years agostand/lua: Don't set ACPI off just because we can't detect it.
kevans [Tue, 20 Feb 2018 02:03:29 +0000 (02:03 +0000)]
stand/lua: Don't set ACPI off just because we can't detect it.

This should unbreak EFI/!i386 cases.

Reported by: Peter Lei <peter.lei@ieee.org>

6 years agoFurther parallelize the buffer cache.
jeff [Tue, 20 Feb 2018 00:06:07 +0000 (00:06 +0000)]
Further parallelize the buffer cache.

Provide multiple clean queues partitioned into 'domains'.  Each domain manages
its own bufspace and has its own bufspace daemon.  Each domain has a set of
subqueues indexed by the current cpuid to reduce lock contention on the cleanq.

Refine the sleep/wakeup around the bufspace daemon to use atomics as much as
possible.

Add a B_REUSE flag that is used to requeue bufs during the scan to approximate
LRU rather than locking the queue on every use of a frequently accessed buf.

Implement bufspace_reserve with only atomic_fetchadd to avoid loop restarts.

Reviewed by: markj
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14274

6 years agostand/lua: Wrap tuple assignment earlier for readability
kevans [Mon, 19 Feb 2018 22:56:04 +0000 (22:56 +0000)]
stand/lua: Wrap tuple assignment earlier for readability

6 years agostyle.lua(9): Note that wrapping at 80-columns is not rigid
kevans [Mon, 19 Feb 2018 22:54:10 +0000 (22:54 +0000)]
style.lua(9): Note that wrapping at 80-columns is not rigid

6 years agostand/lua: Cache swapped menu, and don't create locals for swapping
kevans [Mon, 19 Feb 2018 22:29:16 +0000 (22:29 +0000)]
stand/lua: Cache swapped menu, and don't create locals for swapping

Building the swapped welcome menu (first two items swapped) is kind of a
sluggish, because it requires a full (recrusive) shallow copy of the welcome
menu. Cache the result of that and re-use it later, instead of building it
everytime.

While here, don't create temporary locals just for swapping. The following
is just as good:

x, y = y, x;

Reported by: Alexander Nasonov <alnsn@yandex.ru> (swapping)

6 years agotail: fix "tail -r" for piped input that begins with '\n'
asomers [Mon, 19 Feb 2018 22:09:49 +0000 (22:09 +0000)]
tail: fix "tail -r" for piped input that begins with '\n'

A subtle logic bug, probably introduced in r311895, caused tail to print the
first two lines of piped input in forward order, if the very first character
was a newline.

PR: 222671
Reported by: Jim Long <freebsd-bugzilla@umpquanet.com>, pprocacci@gmail.com
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAdd more virtqueue getter methods
bryanv [Mon, 19 Feb 2018 19:31:18 +0000 (19:31 +0000)]
Add more virtqueue getter methods

MFC after: 2 weeks