bugGNU GRUB - Bugs: bug #23732, missing mapping from fs-block-no....

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #23732: missing mapping from fs-block-no. to disk-block-no. in xfs.c

Submitter:  Niels Böhm <blubberdiblub>
Submitted:  Sat 28 Jun 2008 12:34:08 PM UTC
   
 
Category:  Filesystem Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  None
Release:  1.96, but probably any Reproducibility:  Every Time
Planned Release:  None

Sun 29 Jun 2008 09:33:56 PM UTC, comment #1: 

Committed, thanks!

Robert Millan <robertmh>
Group administrator
Sat 28 Jun 2008 12:34:08 PM UTC, original submission:  

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

Niels Böhm <blubberdiblub>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by robertmh (Posted a comment)
  • -email is unavailable- added by blubberdiblub (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-06-29 robertmh Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code