Skip to content

Commit

Permalink
fix(dracut.sh): unfreeze /boot on exit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tsipa authored and haraldh committed Feb 23, 2021
1 parent c3f2418 commit d87ae13
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,9 @@ readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
trap '
ret=$?;
[[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
if [[ ${FSFROZEN} ]]; then
fsfreeze -u "${FSFROZEN}"
fi
exit $ret;
' EXIT
Expand Down Expand Up @@ -2304,9 +2307,11 @@ if [[ -d $dracutsysrootdir/run/systemd/system ]]; then
# use fsfreeze only if we're not writing to /
if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then
if ! (fsfreeze -f "$(dirname "$outfile")" 2>/dev/null && fsfreeze -u "$(dirname "$outfile")" 2>/dev/null); then
FSFROZEN="$(dirname "$outfile")"
if ! (fsfreeze -f "${FSFROZEN}" 2>/dev/null && fsfreeze -u "${FSFROZEN}" 2>/dev/null); then
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
fi
unset FSFROZEN
fi
fi
Expand Down

0 comments on commit d87ae13

Please sign in to comment.