]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - gnu/usr.bin/cc/cc_tools/i386-freebsd.opt
MFV r353617: 9425 allow channel programs to be stopped via signals
authorAndriy Gapon <avg@FreeBSD.org>
Wed, 16 Oct 2019 07:00:18 +0000 (07:00 +0000)
committerAndriy Gapon <avg@FreeBSD.org>
Wed, 16 Oct 2019 07:00:18 +0000 (07:00 +0000)
commit9efb961d9a2729ac59ee40380290cf291b7311fe
tree4b6ce9c4c3032caca0e8d4c8edc77471aa008515
parent179e6dab09de68556802601d02b61845583c26ca
parent35b885b060938f1f618e83e93a871548e64005c4
MFV r353617: 9425 allow channel programs to be stopped via signals

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

https://www.illumos.org/issues/9425
  Problem Statement
  ZFS Channel program scripts currently require a timeout, so that hung
  or long-running scripts return a timeout error instead of causing ZFS
  to get wedged.  This limit can currently be set up to 100 million Lua
  instructions. Even with a limit in place, it would be desirable to
  have a sys admin (support engineer) be able to cancel a script that is
  taking a long time.

  Proposed Solution
  Make it possible to abort a channel program by sending an interrupt
  signal.In the underlying txg_wait_sync function, switch the cv_wait to
  a cv_wait_sig to catch the signal. Once a signal is encountered, the
  dsl_sync_task function can install a Lua hook that will get called
  before the Lua interpreter executes a new line of code. The
  dsl_sync_task can resume with a standard txg_wait_sync call and wait
  for the txg to complete. Meanwhile, the hook will abort the script and
  indicate that the channel program was canceled. The kernel returns a
  EINTR to indicate that the channel program run was canceled.

FreeBSD note: the return value of cv_wait_sig() has inverted meaning
between us and illumos.

Author: Don Brady <don.brady@delphix.com>
Obtained from: illumos
MFC after: 4 weeks
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c