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

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