7414ca
From 1126a69746b6e0625d4a8db3b246a3edb7c5f551 Mon Sep 17 00:00:00 2001
7414ca
From: Ankit Kumar <ankit@linux.vnet.ibm.com>
7414ca
Date: Mon, 7 Aug 2017 12:13:53 +0530
7414ca
Subject: [PATCH] Sync initramfs after creation
7414ca
7414ca
If we trigger crash just after creating initramfs, sometimes it is
7414ca
observed that initramfs is not written to disk causing the subsequent
7414ca
boot to fail. A sync should resolve this.
7414ca
7414ca
Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
7414ca
---
7414ca
 dracut.sh | 6 ++++++
7414ca
 1 file changed, 6 insertions(+)
7414ca
7414ca
diff --git a/dracut.sh b/dracut.sh
7414ca
index 27489528..9df63cd7 100755
7414ca
--- a/dracut.sh
7414ca
+++ b/dracut.sh
7414ca
@@ -1704,4 +1704,10 @@ else
7414ca
     exit 1
7414ca
 fi
7414ca
 
7414ca
+sync $outfile 2> /dev/null
7414ca
+if [ $? -ne 0 ] ; then
7414ca
+    dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
7414ca
+    exit 1
7414ca
+fi
7414ca
+
7414ca
 exit 0