Skip to content

Commit d87ae13

Browse files
tsipaharaldh
authored andcommitted
fix(dracut.sh): unfreeze /boot on exit
If SIGWHATEVER will be processed after fsfreeze -f, but before fsfreeze -u we will end up with /boot/ never unfrozen, let's try to minimize risk of this.
1 parent c3f2418 commit d87ae13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dracut.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,9 @@ readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
10091009
trap '
10101010
ret=$?;
10111011
[[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
1012+
if [[ ${FSFROZEN} ]]; then
1013+
fsfreeze -u "${FSFROZEN}"
1014+
fi
10121015
exit $ret;
10131016
' EXIT
10141017
@@ -2304,9 +2307,11 @@ if [[ -d $dracutsysrootdir/run/systemd/system ]]; then
23042307
23052308
# use fsfreeze only if we're not writing to /
23062309
if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then
2307-
if ! (fsfreeze -f "$(dirname "$outfile")" 2>/dev/null && fsfreeze -u "$(dirname "$outfile")" 2>/dev/null); then
2310+
FSFROZEN="$(dirname "$outfile")"
2311+
if ! (fsfreeze -f "${FSFROZEN}" 2>/dev/null && fsfreeze -u "${FSFROZEN}" 2>/dev/null); then
23082312
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
23092313
fi
2314+
unset FSFROZEN
23102315
fi
23112316
fi
23122317

0 commit comments

Comments
 (0)