Bug#239111: grub and xfs

David Everly David Everly <deckrider@gmail.com>, 239111@bugs.debian.org
Mon, 25 Apr 2005 12:12:26 -0600


--Hf61M2y+wYpnELGG
Content-Type: multipart/mixed; boundary="ncSAzJYg3Aa9+CRW"
Content-Disposition: inline


--ncSAzJYg3Aa9+CRW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Sorry, but I realized after reading ...

    http://lists.debian.org/debian-boot/2004/06/msg02301.html

=2E.. that what I was doing was a little overkill.

Here is a better approach.  I've tested it both on ext3 (to ensure I
haven't broken something when xfs_freeze exists, but the filesystem is
not xfs), and xfs.

Here is xfs_freeze.diff, suitable for replacing xfs_freeze.diff that is
in debian/patches of the source package.

--=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

--ncSAzJYg3Aa9+CRW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xfs_freeze.diff"
Content-Transfer-Encoding: quoted-printable

--- svn.old/util/grub-install.in	2005-04-25 11:47:21.563643409 -0600
+++ svn/util/grub-install.in	2005-04-25 11:51:26.828576206 -0600
@@ -81,6 +81,17 @@
 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 () {
+    if which xfs_freeze >/dev/null ; then
+        xfs_freeze -f ${grubdir} 2>/dev/null
+	sleep 1
+	xfs_freeze -u ${grubdir} 2>/dev/null
+    fi
+}
+
 # Usage: convert os_device
 # Convert an OS device to the corresponding GRUB drive.
 # This part is OS-specific.
@@ -336,6 +347,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
@@ -426,6 +438,7 @@
     count=3D5
     tmp=3D`echo $file | sed "s|^${grubdir}|${grub_prefix}|"`
     while test $count -gt 0; do
+        xfs_hack
 	$grub_shell --batch $no_floppy --device-map=3D$device_map <<EOF >$log_file
 dump ${root_drive}${tmp} ${img_file}
 quit
@@ -451,6 +464,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

--ncSAzJYg3Aa9+CRW--

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

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

iD8DBQFCbTMKZCfddIUnua8RArDkAJ9tlypHBeuj784yy4rG2zS2n/MD7ACgl0e3
xdmnclZHcS7esZPqxXDMr14=
=l2HG
-----END PGP SIGNATURE-----

--Hf61M2y+wYpnELGG--