dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/systemd-mdadm-last-resort-use-ConditionPathExists-in.patch

2c1b57
From 5c4b3b9aa9f576305b36d5ccbd4b929b51307ce9 Mon Sep 17 00:00:00 2001
2c1b57
From: NeilBrown <neilb@suse.com>
2c1b57
Date: Thu, 20 Apr 2017 12:40:05 +1000
2c1b57
Subject: [RHEL7.5 PATCH 088/169] systemd/mdadm-last-resort: use
2c1b57
 ConditionPathExists instead of Conflicts
2c1b57
2c1b57
Commit cec72c071bbe ("systemd/mdadm-last-resort: add Conflicts to .service file.")
2c1b57
2c1b57
added a 'Conflicts' directive to the mdadm-last-resort@.service file in
2c1b57
the hope that this would make sure the service didn't run after the device
2c1b57
was active, even if the timer managed to get started, which is possible in
2c1b57
race conditions.
2c1b57
2c1b57
This seemed to work is testing, but it isn't clear why, and it is known
2c1b57
to cause problems.
2c1b57
If systemd happens to know that the mentioned device is a dependency of a
2c1b57
mount point, the Conflicts can unmount that mountpoint, which is certainly
2c1b57
not wanted.
2c1b57
2c1b57
So remove the "Conflicts" and instead use
2c1b57
 ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
2c1b57
2c1b57
The "sync_action" file exists for any array which requires last-resort
2c1b57
handling, and only appears when the array is activated.  So it is safe
2c1b57
to rely on it to determine if the last-resort is really needed.
2c1b57
2c1b57
Fixes: cec72c071bbe ("systemd/mdadm-last-resort: add Conflicts to .service file.")
2c1b57
Signed-off-by: NeilBrown <neilb@suse.com>
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 systemd/mdadm-last-resort@.service | 2 +-
2c1b57
 1 file changed, 1 insertion(+), 1 deletion(-)
2c1b57
2c1b57
diff --git a/systemd/mdadm-last-resort@.service b/systemd/mdadm-last-resort@.service
2c1b57
index e93d72b..f9d4d12 100644
2c1b57
--- a/systemd/mdadm-last-resort@.service
2c1b57
+++ b/systemd/mdadm-last-resort@.service
2c1b57
@@ -1,7 +1,7 @@
2c1b57
 [Unit]
2c1b57
 Description=Activate md array even though degraded
2c1b57
 DefaultDependencies=no
2c1b57
-Conflicts=sys-devices-virtual-block-%i.device
2c1b57
+ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
2c1b57
 
2c1b57
 [Service]
2c1b57
 Type=oneshot
2c1b57
-- 
2c1b57
2.7.4
2c1b57