mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH] dracut: write initramfs to temp file then move into place
@ 2013-02-21 21:40 lars-3XmpO8hA3EAAvxtiuMwx3w
       [not found] ` <1361482823-30898-1-git-send-email-lars-3XmpO8hA3EAAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: lars-3XmpO8hA3EAAvxtiuMwx3w @ 2013-02-21 21:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Lars R. Damerow

From: "Lars R. Damerow" <lars-3XmpO8hA3EAAvxtiuMwx3w@public.gmane.org>

We've been finding cases where multiple instances of dracut can be launched
simultaneously, resulting in a corrupted initramfs file. This patch makes
dracut write the initramfs to a new file, then move it into place atomically.
---
 dracut.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 31cf2a5..da96aaa 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1103,10 +1103,11 @@ fi
 rm -f "$outfile"
 dinfo "*** Creating image file ***"
 if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
-    $compress > "$outfile"; ); then
-    dfatal "dracut: creation of $outfile failed"
+    $compress > "$outfile.$$"; ); then
+    dfatal "dracut: creation of $outfile.$$ failed"
     exit 1
 fi
+mv $outfile.$$ $outfile
 dinfo "*** Creating image file done ***"
 
 dinfo "Wrote $outfile:"
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-22  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-21 21:40 [PATCH] dracut: write initramfs to temp file then move into place lars-3XmpO8hA3EAAvxtiuMwx3w
     [not found] ` <1361482823-30898-1-git-send-email-lars-3XmpO8hA3EAAvxtiuMwx3w@public.gmane.org>
2013-02-22  9:57   ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox