Here's another possibility: don't run xfs_freeze at all but instead run a separate program that does ioctl(FIBMAP). This works for me on ext3 in that it doesn't break installation. Please can you test this with a fresh installation of grub on XFS?
diff -urN grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in --- grub-0.97.orig/util/grub-install.in 2004-07-24 19:57:31.000000000 +0100 +++ grub-0.97/util/grub-install.in 2009-01-04 19:26:31.000000000 +0000 @@ -30,6 +30,7 @@ pkglibdir=${libdir}/${PACKAGE}/${host_cpu}-${host_vendor} grub_shell=${sbindir}/grub +grub_map_file=${sbindir}/grub-map-file grub_set_default=${sbindir}/grub-set-default log_file=/tmp/grub-install.log.$$ img_file=/tmp/grub-install.img.$$ @@ -471,6 +472,7 @@ test -n "$mklog" && log_file=`$mklog` for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do + $grub_map_file $file || exit 1 count=5 tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` while test $count -gt 0; do diff -urN grub-0.97.orig/util/grub-map-file.c grub-0.97/util/grub-map-file.c --- grub-0.97.orig/util/grub-map-file.c 1970-01-01 01:00:00.000000000 +0100 +++ grub-0.97/util/grub-map-file.c 2009-01-04 19:19:44.000000000 +0000 @@ -0,0 +1,76 @@ +/* grub-map-file - force block-mapping for a file using ioctl(FIBMAP) */ +/* + * Copyright (C) 2008 Ben Hutchings <b...@decadent.org.uk>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define _FILE_OFFSET_BITS 64 + +#include <errno.h> +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <linux/fs.h> + +int +main (int argc, char **argv) +{ + int fd; + struct stat stats; + unsigned long n, i; + + if (argc != 2) + { + fprintf (stderr, "Usage: grub-map-file FILENAME\n"); + exit (2); + } + + fd = open (argv[1], O_RDONLY); + if (fd < 0) + { + fprintf (stderr, "grub-map-file: open %s: %s\n", + argv[1], strerror (errno)); + exit (1); + } + + if (fstat (fd, &stats)) + { + fprintf (stderr, "grub-map-file: stat %s: %s\n", + argv[1], strerror (errno)); + exit (1); + } + n = (stats.st_size + stats.st_blksize - 1) / stats.st_blksize; + + for (i = 0; i < n; i++) + { + unsigned long temp = i; + if (ioctl (fd, FIBMAP, &temp)) + { + fprintf (stderr, "grub-map-file: FIBMAP %s: %s\n", + argv[1], strerror (errno)); + exit (1); + } + } + + return 0; +} diff -urN grub-0.97.orig/util/Makefile.am grub-0.97/util/Makefile.am --- grub-0.97.orig/util/Makefile.am 2004-06-19 20:52:06.000000000 +0100 +++ grub-0.97/util/Makefile.am 2009-01-04 19:21:05.000000000 +0000 @@ -1,4 +1,5 @@ bin_PROGRAMS = mbchk +sbin_PROGRAMS = grub-map-file sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \ grub-set-default noinst_SCRIPTS = grub-image mkbimage @@ -10,3 +11,5 @@ mbchk_SOURCES = mbchk.c mbchk_LDADD = ../lib/libcommon.a + +grub_map_file_SOURCES = grub-map-file.c --- END --- If that doesn't work, please also test my previously proposed patch: --- grub-0.97.orig/util/grub-install.in 2004-07-24 19:57:31.000000000 +0100 +++ grub-0.97/util/grub-install.in 2009-01-04 04:57:47.000000000 +0000 @@ -418,6 +418,12 @@ # Make a default file. ${grub_set_default} --root-directory=${rootdir} default +# XFS is special; we must run xfs_freeze to flush files as well as sync +# (which grub itself does). +if [ "$(stat -f --printf=%T ${grubdir})" = "xfs" ]; then + xfs_freeze -f ${grubdir} && xfs_freeze -u ${grubdir} +fi + # Make sure that GRUB reads the same images as the host OS. test -n "$mkimg" && img_file=`$mkimg` test -n "$mklog" && log_file=`$mklog` --- END --- Either of these patches should replace debian/patches/xfs_freeze.diff in the source package. Ben. -- Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
signature.asc
Description: This is a digitally signed message part