bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Another semi-critical one... (was Re: towards 0.91 )


From: erich
Subject: [PATCH] Another semi-critical one... (was Re: towards 0.91 )
Date: Sat, 27 Oct 2001 13:24:57 -0700

I just found another semi-critical bug, whose fix should really get
into 0.91.

It turns out that "grub-install" doesn't have any "sync" calls to make
sure any filesystem caches are coherent with the raw devices they are
on top of...  so if your filesystem waits to write out any data from the
copy command in the script to put the "stage1" and "stage2" in their
final location, you're hosed.

I found this because it just bit me on one of my systems running stock
RedHat 7.2 with a large "stage2".

The only script that is patched here is "grub-install".  The others
don't appear to need it as they either unmount things first or don't
refer to devices.

Hmm.  Maybe the right fix is to make the "sync" system call when
starting the GRUB shell with a device map that refers to any real disks
or something like that.

------------------------(start patch)-----------------------
--- grub.orig/util/grub-install.in      Mon Oct 22 16:46:07 2001
+++ grub/util/grub-install.in   Sat Oct 27 13:06:33 2001
@@ -244,6 +244,10 @@
     # Create a safe temporary file.
     test -x /bin/tempfile && log_file=`tempfile --prefix=grub`

+    # Before all invocations of the grub shell, call sync to make sure
+    # the raw device is in sync with any bufferring in filesystems.
+    sync
+
     $grub_shell --batch --device-map=$device_map <<EOF >$log_file
 quit
 EOF
@@ -318,6 +322,10 @@
 # Create a safe temporary file.
 test -x /bin/tempfile && log_file=`tempfile --prefix=grub`

+# Before all invocations of the grub shell, call sync to make sure
+# the raw device is in sync with any bufferring in filesystems.
+sync
+
 # Now perform the installation.
 $grub_shell --batch --device-map=$device_map <<EOF >$log_file
 root $root_drive
------------------------(end patch)-----------------------

--
    Erich Stefan Boleyn     <address@hidden>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]