[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #23732] missing mapping from fs-block-no. to disk-block-no. in xfs.

From: Niels Böhm
Subject: [bug #23732] missing mapping from fs-block-no. to disk-block-no. in xfs.c
Date: Sat, 28 Jun 2008 12:34:10 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080404 Iceweasel/ (Debian-


                 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: 




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()

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 ;)



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]