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

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