Niels Böhm
Sat, 28 Jun 2008 05:34:17 -0700
URL: <http://savannah.gnu.org/bugs/?23732> Summary: missing mapping from fs-block-no. to disk-block-no. in xfs.c Project: GNU GRUB Submitted by: blubberdiblub Submitted on: Saturday 06/28/2008 at 12:34 Category: Filesystem Severity: Major Priority: 5 - Normal Item Group: Software Error Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Discussion Lock: Any Release: 1.96, but probably any Reproducibility: Every Time Planned Release: _______________________________________________________ Details: Hi, my root partition is an XFS filesystem, including /boot and /boot/grub. Grub had problems listing many directories correctly, producing garbled junk and barfing with "error: out of partition". Also some files read back data that was not in them. I tracked the problem down to 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. Here is what I did to fix it: ---- --- grub-1.96/fs/xfs.c 2008-02-03 14:11:30.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); } ---- I have no idea if I did it correctly, since I have no experience with grub's code, but it works for me ;) Regards, Niels _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?23732> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub