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