Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: Chris Williamson <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>

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.

Upstream Bug: DLPX-47799
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/469

-- Commit Summary --

  * 8677 Open-Context Channel Programs

-- File Changes --

    M usr/src/cmd/zfs/zfs_main.c (18)
    M usr/src/lib/libzfs/common/libzfs_dataset.c (2)
    M usr/src/lib/libzfs_core/common/libzfs_core.c (51)
    M usr/src/lib/libzfs_core/common/libzfs_core.h (6)
    M usr/src/lib/libzfs_core/common/mapfile-vers (1)
    M usr/src/man/man1m/zfs-program.1m (9)
    M usr/src/man/man1m/zfs.1m (11)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/channel_common.kshlib 
(181)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh
 (2)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh
 (4)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_snap.ksh
 (4)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.promote_conflict.ksh
 (4)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.promote_multiple.ksh
 (4)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.promote_simple.ksh
 (4)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.rollback_mult.ksh
 (2)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.rollback_one.ksh
 (2)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.snapshot_destroy.ksh
 (2)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.snapshot_neg.ksh
 (3)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.snapshot_recursive.ksh
 (2)
    M 
usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.snapshot_simple.ksh
 (2)
    M usr/src/uts/common/fs/zfs/dsl_destroy.c (1)
    M usr/src/uts/common/fs/zfs/sys/zcp.h (28)
    M usr/src/uts/common/fs/zfs/zcp.c (142)
    M usr/src/uts/common/fs/zfs/zcp_synctask.c (43)
    M usr/src/uts/common/fs/zfs/zfs_ioctl.c (6)
    M usr/src/uts/common/sys/fs/zfs.h (1)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/469.patch
https://github.com/openzfs/openzfs/pull/469.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/469

------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T7aeda5c8d43adc6a-Meb1e7c29df53d77832c7d9e8
Powered by Topicbox: https://topicbox.com

Reply via email to