Skip to content

Commit 654f2dc

Browse files
authored
zed: Add synchronous zedlets
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 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #17335
1 parent bc0b531 commit 654f2dc

15 files changed

+289
-37
lines changed

cmd/zed/zed.d/Makefile.am

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ dist_zedexec_SCRIPTS = \
99
%D%/all-debug.sh \
1010
%D%/all-syslog.sh \
1111
%D%/data-notify.sh \
12-
%D%/deadman-slot_off.sh \
12+
%D%/deadman-sync-slot_off.sh \
1313
%D%/generic-notify.sh \
14-
%D%/pool_import-led.sh \
14+
%D%/pool_import-sync-led.sh \
1515
%D%/resilver_finish-notify.sh \
1616
%D%/resilver_finish-start-scrub.sh \
1717
%D%/scrub_finish-notify.sh \
18-
%D%/statechange-led.sh \
18+
%D%/statechange-sync-led.sh \
1919
%D%/statechange-notify.sh \
20-
%D%/statechange-slot_off.sh \
20+
%D%/statechange-sync-slot_off.sh \
2121
%D%/trim_finish-notify.sh \
22-
%D%/vdev_attach-led.sh \
23-
%D%/vdev_clear-led.sh
22+
%D%/vdev_attach-sync-led.sh \
23+
%D%/vdev_clear-sync-led.sh
2424

2525
nodist_zedexec_SCRIPTS = \
2626
%D%/history_event-zfs-list-cacher.sh
@@ -30,17 +30,17 @@ SUBSTFILES += $(nodist_zedexec_SCRIPTS)
3030
zedconfdefaults = \
3131
all-syslog.sh \
3232
data-notify.sh \
33-
deadman-slot_off.sh \
33+
deadman-sync-slot_off.sh \
3434
history_event-zfs-list-cacher.sh \
35-
pool_import-led.sh \
35+
pool_import-sync-led.sh \
3636
resilver_finish-notify.sh \
3737
resilver_finish-start-scrub.sh \
3838
scrub_finish-notify.sh \
39-
statechange-led.sh \
39+
statechange-sync-led.sh \
4040
statechange-notify.sh \
41-
statechange-slot_off.sh \
42-
vdev_attach-led.sh \
43-
vdev_clear-led.sh
41+
statechange-sync-slot_off.sh \
42+
vdev_attach-sync-led.sh \
43+
vdev_clear-sync-led.sh
4444

4545
dist_noinst_DATA += %D%/README
4646

File renamed without changes.

cmd/zed/zed.d/pool_import-led.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmd/zed/zed.d/pool_import-sync-led.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
statechange-sync-led.sh
File renamed without changes.
File renamed without changes.

cmd/zed/zed.d/vdev_attach-led.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmd/zed/zed.d/vdev_attach-sync-led.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
statechange-sync-led.sh

cmd/zed/zed.d/vdev_clear-led.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmd/zed/zed.d/vdev_clear-sync-led.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
statechange-sync-led.sh

0 commit comments

Comments
 (0)