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