-
Notifications
You must be signed in to change notification settings - Fork 1.8k
zed: Add synchronous zedlets #17335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
zed: Add synchronous zedlets #17335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nice and easy to use. Are there any existing zedlets we ship which should be made synchronous as part of this change?
tests/zfs-tests/tests/functional/events/zed_synchronous_zedlet.ksh
Outdated
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/events/zed_synchronous_zedlet.ksh
Outdated
Show resolved
Hide resolved
@behlendorf I updated this with your changes, including a |
Probably these:
...potentially the LED scripts too:
However, the LED scripts can take in the milliseconds to seconds range to change the LED value, so I can understand keeping them async. |
Historically, ZED has blindly spawned off zedlets in parallel and never worried about their completion order. This means that you can potentially have zedlets for event number 2 starting before zedlets for event number 1 had finished. Most of the time this is fine, and it actually helps a lot when the system is getting spammed with hundreds of events. However, there are times when you want your zedlets to be executed in sequence with the event ID. That is where synchronous zedlets come in. ZED will wait for all previously spawned zedlets to finish before running a synchronous zedlet. Synchronous zedlets are guaranteed to be the only zedlet running. No other zedlets may run in parallel with a synchronous zedlet. Users should be careful to only use synchronous zedlets when needed, since they decrease parallelism. To make a zedlet synchronous, simply add a "-sync-" immediately following the event name in the zedlet's file name: EVENT_NAME-sync-ZEDLETNAME.sh For example, if you wanted a synchronous statechange script: statechange-sync-myzedlet.sh Signed-off-by: Tony Hutter <[email protected]>
I ended up marking all those zedlets I mentioned earlier as synchronous in my latest push. |
It was mentioned at the OpenZFS meeting today that we should add in timeouts for the synchronous zedlets. Let me look into that... |
Motivation and Context
Allow zedlets to execute synchronously.
Description
Historically, ZED has blindly spawned off zedlets in parallel and never worried about their completion order. This means that you can potentially have zedlets for event number 2 starting before zedlets for event number 1 had finished. Most of the time this is fine, and it actually helps a lot when the system is getting spammed with hundreds of events.
However, there are times when you want your zedlets to be executed in sequence with the event ID. That is where synchronous zedlets come in.
ZED will wait for all previously spawned zedlets to finish before running a synchronous zedlet. Synchronous zedlets are guaranteed to be the only zedlet running. No other zedlets may run in parallel with a synchronous zedlet. Users should be careful to only use synchronous zedlets when needed, since they decrease parallelism.
To make a zedlet synchronous, simply add a "-sync-" immediately following the event name in the zedlet's file name:
For example, if you wanted a synchronous statechange script:
How Has This Been Tested?
Test case added
Types of changes
Checklist:
Signed-off-by
.