]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Sync initramfs after creation 293/head
authorAnkit Kumar <ankit@linux.vnet.ibm.com>
Mon, 7 Aug 2017 06:43:53 +0000 (12:13 +0530)
committerHarald Hoyer <harald@redhat.com>
Mon, 7 Aug 2017 07:03:46 +0000 (09:03 +0200)
If we trigger crash just after creating initramfs, sometimes it is
observed that initramfs is not written to disk causing the subsequent
boot to fail. A sync should resolve this.

Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
dracut.sh

index 70dc79d040a9b7d09a335ba98eeff463f360a36b..81e1562ddd46bb5a5eb5ca657211ee4801811a7a 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1806,4 +1806,10 @@ fi
 
 command -v restorecon &>/dev/null && restorecon -- "$outfile"
 
+sync $outfile 2> /dev/null
+if [ $? -ne 0 ] ; then
+    dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
+    exit 1
+fi
+
 exit 0