~ubuntu-branches/ubuntu/utopic/grub/utopic

« back to all changes in this revision

Viewing changes to debian/patches/grub-install_addsyncs.diff

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2005-11-30 18:00:45 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051130180045-q90uxa58hf9pdrrp
Tags: 0.97-1ubuntu1
* Resynchronise with Debian.
* Drop Nathaniel McCallum's nonaltoptions patch, done differently in
  Debian (as defoptions); added migration code to deal with old Ubuntu
  menu.lst files.
* Drop Matthew Garrett's stage 2 drive fallback patch, since upstream has
  implemented a different solution which appears to address essentially
  the same problem.
* Generated debian/control once from debian/control.in using
  type-handling, but continue to avoid the build-dependency on
  type-handling; the generated debian/control is in the source package.
* Disable fix_amd64_compile.diff for now; it causes configure to fail with
  "GRUB requires a working absolute objcopy; upgrade your binutils".

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
    Date: 2005-11-11
 
3
    Author: Otavio Salvador
 
4
    Comment: Stolen from Fedora grub package.
 
5
     Add syncs to ensure that filesystem cache are flushed.
 
6
 
 
7
 -- Original comment, bellow
 
8
 
 
9
I just found another semi-critical bug, whose fix should really get
 
10
into 0.91.
 
11
 
 
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.
 
17
 
 
18
I found this because it just bit me on one of my systems running stock
 
19
RedHat 7.2 with a large "stage2".
 
20
 
 
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
 
23
refer to devices.
 
24
 
 
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.
 
28
 
 
29
    Erich Stefan Boleyn     <erich@uruk.org>     http://www.uruk.org/
 
30
"Reality is truly stranger than fiction; Probably why fiction is so popular"
 
31
 
 
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
 
34
@@ -351,6 +351,10 @@
 
35
     # Create a safe temporary file.
 
36
     test -n "$mklog" && log_file=`$mklog`
 
37
 
 
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.
 
40
+    sync
 
41
 
42
     $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
 
43
 quit
 
44
 EOF
 
45
@@ -457,6 +461,10 @@
 
46
 # Create a safe temporary file.
 
47
 test -n "$mklog" && log_file=`$mklog`
 
48
 
 
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.
 
51
+sync
 
52
+
 
53
 # Now perform the installation.
 
54
 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
 
55
 root $root_drive