Skip to content

Commit

Permalink
systemd: add missing Before=shutdown.target to LVM2 services to fix s…
Browse files Browse the repository at this point in the history
…hutdown ordering

We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.

Reported here: #17
  • Loading branch information
prajnoha committed Apr 9, 2019
1 parent b79f1e1 commit 0a726a7
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.185 -
==================================
Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.

Version 2.02.184 - 22nd March 2019
==================================
Expand Down
1 change: 1 addition & 0 deletions scripts/blk_availability_systemd_red_hat.service.in
@@ -1,5 +1,6 @@
[Unit]
Description=Availability of block devices
Before=shutdown.target
After=lvm2-activation.service lvm2-lvmetad.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service rbdmap.service
DefaultDependencies=no
Conflicts=shutdown.target
Expand Down
2 changes: 2 additions & 0 deletions scripts/lvm2_activation_generator_systemd_red_hat.c
Expand Up @@ -127,6 +127,8 @@ static int generate_unit(const char *dir, int unit, int sysinit_needed)
"SourcePath=/etc/lvm/lvm.conf\n"
"DefaultDependencies=no\n", f);

fputs("Conflicts=shutdown.target\n", f);

if (unit == UNIT_NET) {
fprintf(f, "After=%s iscsi.service fcoe.service rbdmap.service\n"
"Before=remote-fs-pre.target shutdown.target\n\n"
Expand Down
1 change: 1 addition & 0 deletions scripts/lvm2_cluster_activation_systemd_red_hat.service.in
@@ -1,6 +1,7 @@
[Unit]
Description=Clustered LVM volumes activation service
Requires=lvm2-clvmd.service
Before=shutdown.target
After=lvm2-clvmd.service lvm2-cmirrord.service
OnFailure=lvm2-clvmd.service
DefaultDependencies=no
Expand Down
2 changes: 1 addition & 1 deletion scripts/lvm2_clvmd_systemd_red_hat.service.in
Expand Up @@ -2,7 +2,7 @@
Description=Clustered LVM daemon
Documentation=man:clvmd(8)
After=dlm.service corosync.service
Before=remote-fs-pre.target
Before=remote-fs-pre.target shutdown.target
Requires=network.target dlm.service corosync.service
RefuseManualStart=true
RefuseManualStop=true
Expand Down
2 changes: 1 addition & 1 deletion scripts/lvm2_cmirrord_systemd_red_hat.service.in
Expand Up @@ -3,7 +3,7 @@ Description=Clustered LVM mirror log daemon
Documentation=man:cmirrord(8)
Requires=corosync.service
After=corosync.service
Before=remote-fs-pre.target
Before=remote-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target

Expand Down
1 change: 1 addition & 0 deletions scripts/lvm2_lvmetad_systemd_red_hat.service.in
Expand Up @@ -2,6 +2,7 @@
Description=LVM2 metadata daemon
Documentation=man:lvmetad(8)
Requires=lvm2-lvmetad.socket
Before=shutdown.target
After=lvm2-lvmetad.socket
DefaultDependencies=no
Conflicts=shutdown.target
Expand Down
2 changes: 0 additions & 2 deletions scripts/lvm2_lvmetad_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
[Unit]
Description=LVM2 metadata daemon socket
Documentation=man:lvmetad(8)
DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket
Expand Down
1 change: 1 addition & 0 deletions scripts/lvm2_lvmpolld_systemd_red_hat.service.in
Expand Up @@ -2,6 +2,7 @@
Description=LVM2 poll daemon
Documentation=man:lvmpolld(8)
Requires=lvm2-lvmpolld.socket
Before=shutdown.target
After=lvm2-lvmpolld.socket
DefaultDependencies=no
Conflicts=shutdown.target
Expand Down
2 changes: 0 additions & 2 deletions scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
[Unit]
Description=LVM2 poll daemon socket
Documentation=man:lvmpolld(8)
DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ListenStream=@DEFAULT_RUN_DIR@/lvmpolld.socket
Expand Down
2 changes: 1 addition & 1 deletion scripts/lvm2_monitoring_systemd_red_hat.service.in
Expand Up @@ -3,7 +3,7 @@ Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progres
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket lvm2-lvmetad.socket
After=dm-event.socket dm-event.service lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service
Before=local-fs-pre.target
Before=local-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target

Expand Down

0 comments on commit 0a726a7

Please sign in to comment.