From: Sergei Iudin Date: Fri, 19 Feb 2021 21:06:03 +0000 (-0800) Subject: fix(dracut.sh): unfreeze /boot on exit X-Git-Tag: 053~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d87ae13721d04a8a2192d896af224ac6965caf70;p=thirdparty%2Fdracut.git 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. --- diff --git a/dracut.sh b/dracut.sh index 800a67643..04581cdbc 100755 --- a/dracut.sh +++ b/dracut.sh @@ -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 @@ -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