tags 239111 + patch
tags 246111 + patch
tags 243835 + patch
thanks

I'm attaching a new version of xfs_freeze.diff which can replace the
current one in the sarge version of grub (debian/patches).

For xfs, in theory it is only needed to run 'xfs_freeze -f' followed
immediately by 'xfs_freeze -u'.  This is because xfs_freeze is not
supposed to return until disk I/O is complete.  However, this is
currently not the case with kernel-image-2.6.8-2-686 2.6.8-13:

   http://bugs.debian.org/306966

So this patch defaults to a 20 second sleep (which is what consistently
works on my systems), but has a new option (--sync-sleep) to customize
the sleep time.

In any case, the existing approach which tries to freeze, run a grub
shell, and then unfreeze really needs to be corrected, since it will
ALWAYS hang a system that is a single XFS partition for everything.

-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
--- svn.old/util/grub-install.in        2005-04-25 11:47:21.000000000 -0600
+++ svn/util/grub-install.in    2005-04-29 10:01:11.978324529 -0600
@@ -40,6 +40,7 @@
 no_floppy=
 force_lba=
 recheck=no
+sync_sleep=20
 debug=no
 
 # look for secure tempfile creation wrappers on this platform
@@ -70,6 +71,8 @@
   --force-lba             force GRUB to use LBA mode even for a buggy
                           BIOS
   --recheck               probe a device map even if it already exists
+  --sync-sleep            number of seconds to sleep while trying to
+                          sync XFS
 
 INSTALL_DEVICE can be a GRUB device name or a system device filename.
 
@@ -81,6 +84,20 @@
 EOF
 }
 
+# Usage: xfs_hack
+# Routine to flush xfs filesystem log (sync doesn't do this)
+# sleep is needed to give time for the log to be flushed
+xfs_hack () {
+    sync
+    if which xfs_freeze >/dev/null ; then
+        echo "Trying to sync filesystem, do not interrupt until complete."
+        xfs_freeze -f ${grubdir} 2>/dev/null
+       sleep $sync_sleep
+       xfs_freeze -u ${grubdir} 2>/dev/null
+        echo "Trying to sync filesystem is complete."
+    fi
+}
+
 # Usage: convert os_device
 # Convert an OS device to the corresponding GRUB drive.
 # This part is OS-specific.
@@ -247,6 +264,8 @@
        force_lba="--force-lba" ;;
     --recheck)
        recheck=yes ;;
+    --sync-sleep=*)
+       sync_sleep=`echo "$option" | sed 's/--sync-sleep=//'` ;;
     # This is an undocumented feature...
     --debug)
        debug=yes ;;
@@ -336,6 +355,7 @@
     # Create a safe temporary file.
     test -n "$mklog" && log_file=`$mklog`
 
+    xfs_hack
     $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
 quit
 EOF
@@ -414,6 +434,7 @@
     ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do
     cp -f $file ${grubdir} || exit 1
 done
+xfs_hack
 
 # Make a default file.
 ${grub_set_default} --root-directory=${rootdir} default
@@ -451,6 +472,7 @@
 test -n "$mklog" && log_file=`$mklog`
 
 # Now perform the installation.
+xfs_hack
 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
 root $root_drive
 setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $install_drive

Attachment: signature.asc
Description: Digital signature

Reply via email to