Harald Hoyer afa7aa
From 28401778c4c95b3750e73675dd4a4867303402d5 Mon Sep 17 00:00:00 2001
Harald Hoyer afa7aa
From: Michal Sekletar <msekleta@redhat.com>
Harald Hoyer afa7aa
Date: Wed, 27 Sep 2017 13:27:42 +0200
Harald Hoyer afa7aa
Subject: [PATCH] systemd: fix setting of timeouts for device units
Harald Hoyer afa7aa
Harald Hoyer afa7aa
JobRunningTimeoutSec now affects how long can start jobs for device
Harald Hoyer afa7aa
units stay in the "running" state. Disabling default job timeout via
Harald Hoyer afa7aa
JobTimeoutSec=0 doesn't disable running state timeout. We need to set
Harald Hoyer afa7aa
running state timeout as well.
Harald Hoyer afa7aa
Harald Hoyer afa7aa
Note that doing this the other way around has effect on generic timeout,
Harald Hoyer afa7aa
i.e. disabling running state timeout disables generic timeout. But doing
Harald Hoyer afa7aa
it this way we would create implicit dependency on fairly new
Harald Hoyer afa7aa
systemd-234. However, by setting both options we don't create dependency
Harald Hoyer afa7aa
on specific systemd version.
Harald Hoyer afa7aa
---
Harald Hoyer afa7aa
 modules.d/90dmsquash-live/dmsquash-generator.sh | 1 +
Harald Hoyer afa7aa
 modules.d/90livenet/livenet-generator.sh        | 1 +
Harald Hoyer afa7aa
 modules.d/98dracut-systemd/rootfs-generator.sh  | 1 +
Harald Hoyer afa7aa
 modules.d/99base/dracut-lib.sh                  | 1 +
Harald Hoyer afa7aa
 4 files changed, 4 insertions(+)
Harald Hoyer afa7aa
Harald Hoyer afa7aa
diff --git a/modules.d/90dmsquash-live/dmsquash-generator.sh b/modules.d/90dmsquash-live/dmsquash-generator.sh
Harald Hoyer afa7aa
index a5bfbdf2..d47cf14a 100755
Harald Hoyer afa7aa
--- a/modules.d/90dmsquash-live/dmsquash-generator.sh
Harald Hoyer afa7aa
+++ b/modules.d/90dmsquash-live/dmsquash-generator.sh
Harald Hoyer afa7aa
@@ -78,4 +78,5 @@ mkdir -p "$GENERATOR_DIR/$_dev.device.d"
Harald Hoyer afa7aa
 {
Harald Hoyer afa7aa
     echo "[Unit]"
Harald Hoyer afa7aa
     echo "JobTimeoutSec=3000"
Harald Hoyer afa7aa
+    echo "JobRunningTimeoutSec=3000"
Harald Hoyer afa7aa
 } > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
Harald Hoyer afa7aa
diff --git a/modules.d/90livenet/livenet-generator.sh b/modules.d/90livenet/livenet-generator.sh
Harald Hoyer afa7aa
index 969ef4f2..a349cd0b 100755
Harald Hoyer afa7aa
--- a/modules.d/90livenet/livenet-generator.sh
Harald Hoyer afa7aa
+++ b/modules.d/90livenet/livenet-generator.sh
Harald Hoyer afa7aa
@@ -57,4 +57,5 @@ mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
Harald Hoyer afa7aa
 {
Harald Hoyer afa7aa
     echo "[Unit]"
Harald Hoyer afa7aa
     echo "JobTimeoutSec=3000"
Harald Hoyer afa7aa
+    echo "JobRunningTimeoutSec=3000"
Harald Hoyer afa7aa
 } > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
Harald Hoyer afa7aa
diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh
Harald Hoyer afa7aa
index eada3d15..4ae693bb 100755
Harald Hoyer afa7aa
--- a/modules.d/98dracut-systemd/rootfs-generator.sh
Harald Hoyer afa7aa
+++ b/modules.d/98dracut-systemd/rootfs-generator.sh
Harald Hoyer afa7aa
@@ -32,6 +32,7 @@ generator_wait_for_dev()
Harald Hoyer afa7aa
         {
Harald Hoyer afa7aa
             echo "[Unit]"
Harald Hoyer afa7aa
             echo "JobTimeoutSec=$_timeout"
Harald Hoyer afa7aa
+            echo "JobRunningTimeoutSec=$_timeout"
Harald Hoyer afa7aa
         } > "$GENERATOR_DIR"/${_name}.device.d/timeout.conf
Harald Hoyer afa7aa
     fi
Harald Hoyer afa7aa
 }
Harald Hoyer afa7aa
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
Harald Hoyer afa7aa
index 80385456..675abf22 100755
Harald Hoyer afa7aa
--- a/modules.d/99base/dracut-lib.sh
Harald Hoyer afa7aa
+++ b/modules.d/99base/dracut-lib.sh
Harald Hoyer afa7aa
@@ -938,6 +938,7 @@ set_systemd_timeout_for_dev()
Harald Hoyer afa7aa
             {
Harald Hoyer afa7aa
                 echo "[Unit]"
Harald Hoyer afa7aa
                 echo "JobTimeoutSec=$_timeout"
Harald Hoyer afa7aa
+                echo "JobRunningTimeoutSec=$_timeout"
Harald Hoyer afa7aa
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
Harald Hoyer afa7aa
             type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
Harald Hoyer afa7aa
             _needreload=1
Harald Hoyer afa7aa