CTDB: Fix race where disabling an event script can cause an event to fail

Map ENOENT for a missing event script to ENOEXEC

This handles the case where an event script is disabled by unlinking, while an event is being run, after the script list has been created. Without this change the script will fail. With this change the script will be marked as DISABLED. See the comment added by this commit for more details.

Add a testcase to simulate the race, using an event script to disable subsequent ones.

https://bugzilla.samba.org/show_bug.cgi?id=15755

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • (optional) This MR is just one part towards a larger feature.
  • (optional, if backport required) Bugzilla bug filed and BUG: tag added
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • CI timeout is 3h or higher (see Settings/CICD/General pipelines/ Timeout)

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to README.Coding.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by Amitay Isaacs

Merge request reports

Loading