Blame SOURCES/0180-ppc64le-sync-mkconfig-to-disk-1212114.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ecb9bb
From: Don Zickus <dzickus@redhat.com>
ecb9bb
Date: Wed, 22 Jul 2015 13:59:55 -0400
28f7f8
Subject: [PATCH] ppc64le sync mkconfig to disk (#1212114)
ecb9bb
ecb9bb
If creating a new grub2 entry using grub2-mkconfig, the entry is not
ecb9bb
immediately sync'd to disk.  If a crash happens before the writeback,
ecb9bb
the subsequent reboot fails because the grub2.cfg is corrupted.
ecb9bb
ecb9bb
Address this by forcing all the changes (mainly the fs meta data) to disk
ecb9bb
before finishing the grub2 conf changes.
ecb9bb
ecb9bb
Tested by 'grub2-mkconfig -o /etc/grub22.cfg; echo c > /proc/sysrq-trigger'.
ecb9bb
ecb9bb
Before, the machine would panic and on reboot be stuck without a grub.cfg
ecb9bb
to read.  After, works as expected.
ecb9bb
ecb9bb
Resolves: rhbz#1212114
ecb9bb
---
ecb9bb
 util/grub-mkconfig.in | 9 +++++++++
ecb9bb
 1 file changed, 9 insertions(+)
ecb9bb
ecb9bb
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
28f7f8
index e029d0d5ea9..cf315e241f6 100644
ecb9bb
--- a/util/grub-mkconfig.in
ecb9bb
+++ b/util/grub-mkconfig.in
ecb9bb
@@ -290,3 +290,12 @@ fi
ecb9bb
 
ecb9bb
 gettext "done" >&2
ecb9bb
 echo >&2
ecb9bb
+
ecb9bb
+# make sure changes make it to the disk.
ecb9bb
+# if /boot is a mountpoint, force the meta data on disk
ecb9bb
+# to by-pass writeback delay.
ecb9bb
+# PPC64LE-only to deal with Petitboot issues
ecb9bb
+ARCH=$(uname -m)
ecb9bb
+if [ "${ARCH}" = "ppc64le" ]; then
ecb9bb
+    sync && mountpoint -q /boot &&fsfreeze -f /boot && fsfreeze -u /boot
ecb9bb
+fi