* [PATCH 1/4] mdraid/mdraid_start.sh: tell mainloop if we make progress.
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
@ 2015-03-26 4:41 ` NeilBrown
2015-03-26 4:41 ` [PATCH 2/4] systemd/dracut-iniqueue - continue waiting if any timeout script makes progress NeilBrown
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
mdraid_start is a number of scripts which run after a timeout.
If it makes progress, it should tell the main loop so that it
knows that it is worth waiting a bit longer.
So in that case, create the initqueue/work file which the main loop
checks for.
Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
---
modules.d/90mdraid/mdraid_start.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 761e64f312d3..400ab5dc46c7 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -27,6 +27,7 @@ _md_force_run() {
_path_d="${_path_s%/*}/degraded"
[ ! -r "$_path_d" ] && continue
+ > $hookdir/initqueue/work
done
}
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] systemd/dracut-iniqueue - continue waiting if any timeout script makes progress
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-26 4:41 ` [PATCH 1/4] mdraid/mdraid_start.sh: tell mainloop if we make progress NeilBrown
@ 2015-03-26 4:41 ` NeilBrown
2015-03-26 4:41 ` [PATCH 3/4] dracut-systemd/rootfs-generator.sh: always create generated files NeilBrown
2015-03-26 4:41 ` [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings NeilBrown
3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
A number of timeout scripts can be registered. If any one of them
makes progress - e.g. assembles a degraded md array - then
the main loop should wait a bit longer rather than pressing forward.
This is particularly important is resume-from-hibernate requires a
degraded md array. Both the script to forcibly assemble the md array
and the script to abort hibernation if the device doesn't appear
are 'timeout' scripts. There needs to be a reasonable delay between
these running.
So: if any script has indicated that progress was made, break of out
the loop and go back to normal waiting.
Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
---
modules.d/98dracut-systemd/dracut-initqueue.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh
index 88cd1e056ed7..af9cec2c5b8c 100755
--- a/modules.d/98dracut-systemd/dracut-initqueue.sh
+++ b/modules.d/98dracut-systemd/dracut-initqueue.sh
@@ -60,6 +60,7 @@ while :; do
job=$job . $job
udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
[ -f $hookdir/initqueue/work ] && main_loop=0
+ [ $main_loop -eq 0 ] && break
done
fi
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] dracut-systemd/rootfs-generator.sh: always create generated files.
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-26 4:41 ` [PATCH 1/4] mdraid/mdraid_start.sh: tell mainloop if we make progress NeilBrown
2015-03-26 4:41 ` [PATCH 2/4] systemd/dracut-iniqueue - continue waiting if any timeout script makes progress NeilBrown
@ 2015-03-26 4:41 ` NeilBrown
2015-03-26 4:41 ` [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings NeilBrown
3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
When 'systemctl daemon-reload' is run, systemd will clean out
/run/systemd/generator and re-run all the generators.
So it is important that the generators always create the required
files.
rootfs-generator.sh currently does *not* create the desired files
if $hookdir/initqueue/finished/devexists-${_name}.sh
exists.
This is not removed by "systectl daemon-reload" so the first time this
generator is run it will do the right thing. Subsequent times it
won't.
This results in incorrect timeouts after "daemon-reload" is run.
So let the existence of each file only guard the creation that file.
Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
---
modules.d/98dracut-systemd/rootfs-generator.sh | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh
index f3c7d1f237df..97512c07ab06 100755
--- a/modules.d/98dracut-systemd/rootfs-generator.sh
+++ b/modules.d/98dracut-systemd/rootfs-generator.sh
@@ -11,14 +11,15 @@ generator_wait_for_dev()
_timeout=$(getarg rd.timeout)
_timeout=${_timeout:-0}
- [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
+ if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then
- printf '[ -e "%s" ]\n' $1 \
- >> "$hookdir/initqueue/finished/devexists-${_name}.sh"
- {
- printf '[ -e "%s" ] || ' $1
- printf 'warn "\"%s\" does not exist"\n' $1
- } >> "$hookdir/emergency/80-${_name}.sh"
+ printf '[ -e "%s" ]\n' $1 \
+ >> "$hookdir/initqueue/finished/devexists-${_name}.sh"
+ {
+ printf '[ -e "%s" ] || ' $1
+ printf 'warn "\"%s\" does not exist"\n' $1
+ } >> "$hookdir/emergency/80-${_name}.sh"
+ fi
_name=$(dev_unit_name "$1")
if ! [ -L /run/systemd/generator/initrd.target.wants/${_name}.device ]; then
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings.
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
` (2 preceding siblings ...)
2015-03-26 4:41 ` [PATCH 3/4] dracut-systemd/rootfs-generator.sh: always create generated files NeilBrown
@ 2015-03-26 4:41 ` NeilBrown
[not found] ` <20150326044148.10121.15286.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
3 siblings, 1 reply; 7+ messages in thread
From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
When systemd's crypttab generator parsed crypttab, it tells
systemd about several devices which may not appear until later
in the boot sequence, and which are not needed while dract is running.
This can particularly happen when an md array is encrypted,
and the array is newly degraded so that it doesn't appear until
dracut runs mdraid_start.sh.
This can result in systemd printing warning messages which are
inappropriate.
So tell systemd that the timeout for each of these is zero.
This is involves splitting some functionality out of wait_for_dev()
That function does two things:
- creates 'finished' hooks so that dracut will wait for the device,
and
- sets the systemd timeout for the device to zero, so systemd doesn't
wait.
We only want the second of these for most encrypted devices.
So split that out into a new function set_systemd_timeout_for_dev(),
and call it from parse-crypt.sh
Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
---
modules.d/90crypt/parse-crypt.sh | 4 +++
modules.d/99base/dracut-lib.sh | 53 ++++++++++++++++++++++++--------------
2 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 94ad1f63ae6f..5a64652cc51c 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -14,6 +14,10 @@ else
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
tout=$(getarg rd.luks.key.tout)
+ while read _dev _uuid ; do
+ set_systemd_timeout_for_dev $_dev
+ done
+
if [ -n "$LUKS" ]; then
for luksid in $LUKS; do
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 259e2057b67e..c8ff3c1a32d1 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -895,12 +895,10 @@ dev_unit_name()
printf -- "%s" "$dev"
}
-# wait_for_dev <dev>
-#
-# Installs a initqueue-finished script,
-# which will cause the main loop only to exit,
-# if the device <dev> is recognized by the system.
-wait_for_dev()
+# set_systemd_timeout_for_dev <dev>
+# Set 'rd.timeout' as the systemd timeout for <dev>
+
+set_systemd_timeout_for_dev()
{
local _name
local _needreload
@@ -915,19 +913,6 @@ wait_for_dev()
_timeout=$(getarg rd.timeout)
_timeout=${_timeout:-0}
- _name="$(str_replace "$1" '/' '\x2f')"
-
- type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
-
- [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
-
- printf '[ -e "%s" ]\n' $1 \
- >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh"
- {
- printf '[ -e "%s" ] || ' $1
- printf 'warn "\"%s\" does not exist"\n' $1
- } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh"
-
if [ -n "$DRACUT_SYSTEMD" ]; then
_name=$(dev_unit_name "$1")
if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then
@@ -952,6 +937,36 @@ wait_for_dev()
fi
fi
}
+# wait_for_dev <dev>
+#
+# Installs a initqueue-finished script,
+# which will cause the main loop only to exit,
+# if the device <dev> is recognized by the system.
+wait_for_dev()
+{
+ local _name
+ local _noreload
+
+ if [ "$1" = "-n" ]; then
+ _noreload=-n
+ shift
+ fi
+
+ _name="$(str_replace "$1" '/' '\x2f')"
+
+ type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
+
+ [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
+
+ printf '[ -e "%s" ]\n' $1 \
+ >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh"
+ {
+ printf '[ -e "%s" ] || ' $1
+ printf 'warn "\"%s\" does not exist"\n' $1
+ } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh"
+
+ set_systemd_timeout_for_dev $_noreload $1
+}
cancel_wait_for_dev()
{
^ permalink raw reply related [flat|nested] 7+ messages in thread