zfs/cmd
Serapheim Dimitropoulos 5b72a38d68 OpenZFS 8677 - Open-Context Channel Programs
Authored by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Chris Williamson <chris.williamson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Don Brady <don.brady@delphix.com>

We want to be able to run channel programs outside of synching
context. This would greatly improve performance for channel programs
that just gather information, as they won't have to wait for synching
context anymore.

=== What is implemented?

This feature introduces the following:
- A new command line flag in "zfs program" to specify our intention
  to run in open context. (The -n option)
- A new flag/option within the channel program ioctl which selects
  the context.
- Appropriate error handling whenever we try a channel program in
  open-context that contains zfs.sync* expressions.
- Documentation for the new feature in the manual pages.

=== How do we handle zfs.sync functions in open context?

When such a function is found by the interpreter and we are running
in open context we abort the script and we spit out a descriptive
runtime error. For example, given the script below ...

arg = ...
fs = arg["argv"][1]
err = zfs.sync.destroy(fs)
msg = "destroying " .. fs .. " err=" .. err
return msg

if we run it in open context, we will get back the following error:

Channel program execution failed:
[string "channel program"]:3: running functions from the zfs.sync
submodule requires passing sync=TRUE to lzc_channel_program()
(i.e. do not specify the "-n" command line argument)
stack traceback:
            [C]: in function 'destroy'
            [string "channel program"]:3: in main chunk

=== What about testing?

We've introduced new wrappers for all channel program tests that
run each channel program as both (startard & open-context) and
expect the appropriate behavior depending on the program using
the zfs.sync module.

OpenZFS-issue: https://www.illumos.org/issues/8677
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/17a49e15
Closes #6558
2018-02-08 16:05:57 -08:00
..
arc_summary Handle broken pipes in arc_summary 2017-12-19 13:19:24 -08:00
arcstat arcstat: flush stdout / outfile after each line 2017-10-26 12:18:49 -07:00
dbufstat Add dbuf hash and dbuf cache kstats 2018-01-29 10:24:52 -08:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Honor --with-mounthelperdir where applicable 2017-12-17 14:14:07 -08:00
raidz_test Support -fsanitize=address with --enable-asan 2018-01-10 10:49:27 -08:00
vdev_id vdev_id: new slot type ses 2017-12-20 09:42:07 -08:00
zdb Fix style issues in man pages and commands help 2018-01-29 15:05:03 -08:00
zed Fix shellcheck v0.4.6 warnings 2018-01-17 10:17:16 -08:00
zfs OpenZFS 8677 - Open-Context Channel Programs 2018-02-08 16:05:57 -08:00
zgenhostid Add zgenhostid utility script 2017-07-25 13:22:03 -04:00
zhack zhack: fix getopt return type 2018-01-09 11:14:45 -08:00
zinject Add corruption failure option to zinject(8) 2017-08-14 15:17:15 -07:00
zpool OpenZFS 7431 - ZFS Channel Programs 2018-02-08 15:28:18 -08:00
zstreamdump Encryption Stability and On-Disk Format Fixes 2018-02-02 11:37:16 -08:00
ztest Set persistent ztest failure mode 2018-02-05 12:00:26 -08:00
zvol_id OpenZFS 6314 - buffer overflow in dsl_dataset_name 2016-06-28 13:47:03 -07:00
Makefile.am Retire legacy test infrastructure 2017-08-15 17:26:38 -07:00