Bug#246111: updated xfs_freeze.diff (--help output improved)

David Everly David Everly <deckrider@gmail.com>, 246111@bugs.debian.org
Tue, 21 Jun 2005 07:03:05 -0600


--Tu8ztk+XgTAiG9Id
Content-Type: multipart/mixed; boundary="54ZiyWcDhi/7bWb8"
Content-Disposition: inline


--54ZiyWcDhi/7bWb8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Here is an updated xfs_freeze.diff

It is the same as the previous version, except the output of --help
is a little better.
--=20
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                           =
    =20
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html

--54ZiyWcDhi/7bWb8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xfs_freeze.diff"
Content-Transfer-Encoding: quoted-printable

--- grub-install	2005-04-25 11:47:21.000000000 -0600
+++ grub-install	2005-04-29 10:01:11.978324529 -0600
@@ -40,6 +40,7 @@
 no_floppy=3D
 force_lba=3D
 recheck=3Dno
+sync_sleep=3D20
 debug=3Dno
=20
 # 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=3DSECONDS    number of seconds to sleep while trying to
+                          sync XFS
=20
 INSTALL_DEVICE can be a GRUB device name or a system device filename.
=20
@@ -81,6 +84,20 @@
 EOF
 }
=20
+# 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=3D"--force-lba" ;;
     --recheck)
 	recheck=3Dyes ;;
+    --sync-sleep=3D*)
+	sync_sleep=3D`echo "$option" | sed 's/--sync-sleep=3D//'` ;;
     # This is an undocumented feature...
     --debug)
 	debug=3Dyes ;;
@@ -336,6 +355,7 @@
     # Create a safe temporary file.
     test -n "$mklog" && log_file=3D`$mklog`
=20
+    xfs_hack
     $grub_shell --batch $no_floppy --device-map=3D$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
=20
 # Make a default file.
 ${grub_set_default} --root-directory=3D${rootdir} default
@@ -451,6 +472,7 @@
 test -n "$mklog" && log_file=3D`$mklog`
=20
 # Now perform the installation.
+xfs_hack
 $grub_shell --batch $no_floppy --device-map=3D$device_map <<EOF >$log_file
 root $root_drive
 setup $force_lba --stage2=3D$grubdir/stage2 --prefix=3D$grub_prefix $insta=
ll_drive

--54ZiyWcDhi/7bWb8--

--Tu8ztk+XgTAiG9Id
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCuBAIZCfddIUnua8RAmlnAJ9L7nXy4t7B07uIaQrPp5m/gSi3nQCfZiYM
4bzA78bdaD+ZPFDjQtw2dmg=
=1wMI
-----END PGP SIGNATURE-----

--Tu8ztk+XgTAiG9Id--