Bug#436943: grub-pc: missing mapping from fs-block-no. to disk-block-no. in xfs.c
Niels Boehm
bitbucket at arcor.de
Sat Jun 28 12:50:36 UTC 2008
Package: grub-pc
Followup-For: Bug #436943
Okay, I hunted the problem down myself. It's a missing mapping from the file
system block numbering scheme ((agno << agbits) | block_in_ag) to the
on-partition block numbering (agno * agsize + block_in_ag) in the
grub_xfs_read_block() function.
It would affect all users who have a partition with more than one allocation
group with an agsize which is not a power of 2.
The problem arises when grub encounters files with blocks not on ag#0 and
directories which are extent lists not stored on ag#0.
I changed the offending file like that:
---- CUT HERE ----
--- grub2-1.96+20080512/fs/xfs.c 2008-02-02 15:15:31.000000000 +0100
+++ xfs.c_Niels 2008-06-28 12:40:39.487565975 +0200
@@ -162,4 +162,8 @@
(grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data))
+#define GRUB_XFS_FSB_TO_BLOCK(data, fsb) \
+ (((fsb) >> (data)->sblock.log2_agblk) * (data)->agsize \
+ + ((fsb) & ((1 << (data)->sblock.log2_agblk) - 1)))
+
#define GRUB_XFS_EXTENT_OFFSET(exts,ex) \
((grub_be_to_cpu32 (exts[ex][0]) & ~(1 << 31)) << 23 \
@@ -309,5 +313,5 @@
grub_free (leaf);
- return ret;
+ return GRUB_XFS_FSB_TO_BLOCK(node->data, ret);
}
---- CUT HERE ----
The patch works fine for me, but I can't tell if I missed any intricacies,
since I'm not into grub development.
I reported it upstream, too.
Hope it helps,
Niels Böhm
-- System Information:
Debian Release: lenny/sid
APT prefers testing-proposed-updates
APT policy: (925, 'testing-proposed-updates'), (925, 'testing'), (825, 'proposed-updates'), (825, 'stable'), (400, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-cerberus-3
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
More information about the Pkg-grub-devel
mailing list