3
Author: Otavio Salvador
4
Comment: Stolen from Fedora grub package.
5
Add syncs to ensure that filesystem cache are flushed.
7
-- Original comment, bellow
9
I just found another semi-critical bug, whose fix should really get
12
It turns out that "grub-install" doesn't have any "sync" calls to make
13
sure any filesystem caches are coherent with the raw devices they are
14
on top of... so if your filesystem waits to write out any data from the
15
copy command in the script to put the "stage1" and "stage2" in their
16
final location, you're hosed.
18
I found this because it just bit me on one of my systems running stock
19
RedHat 7.2 with a large "stage2".
21
The only script that is patched here is "grub-install". The others
22
don't appear to need it as they either unmount things first or don't
25
Hmm. Maybe the right fix is to make the "sync" system call when
26
starting the GRUB shell with a device map that refers to any real disks
27
or something like that.
29
Erich Stefan Boleyn <erich@uruk.org> http://www.uruk.org/
30
"Reality is truly stranger than fiction; Probably why fiction is so popular"
32
--- grub-0.94/util/grub-install.in.addsync 2004-02-02 17:22:26.672520324 -0500
33
+++ grub-0.94/util/grub-install.in 2004-02-02 17:23:16.147712327 -0500
35
# Create a safe temporary file.
36
test -n "$mklog" && log_file=`$mklog`
38
+ # Before all invocations of the grub shell, call sync to make sure
39
+ # the raw device is in sync with any bufferring in filesystems.
42
$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
46
# Create a safe temporary file.
47
test -n "$mklog" && log_file=`$mklog`
49
+# Before all invocations of the grub shell, call sync to make sure
50
+# the raw device is in sync with any bufferring in filesystems.
53
# Now perform the installation.
54
$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file