grub 2: xfs.mod reads some directories incorrectly

2008-06-29 Thread bitbucket
Hello,

I want to bring to your attention a problem with the XFS module of grub2 since 
I was told that you might not always pay attention to the bugtracker. I've 
reported the bug at savannah.gnu.org as well as on the Debian BTS, so I'm 
pasting the interesting snippets from the latter one for your convenience:



From: Alex Malinovich <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: Bug#436943: another confirmation
Date: Tue, 12 Feb 2008 05:06:15 -0800

[Message part 1 (text/plain, inline)]

On Tue, 2008-02-12 at 13:19 +0100, Robert Millan wrote:
--snip--
> On Tue, Feb 12, 2008 at 02:14:55AM -0800, Alex Malinovich wrote:
> > 
> > Oddly, trying to do "ls (hd0,1)/" works just fine. Yet when running
> "ls
> > (hd0,1)/boot" gives that same "out of partition error", even
> > though /boot is NOT on a separate partition.
> 
> Alex, what is your filesystem in (hd0,1)/ ?
> 
> Can you identify the problem if you do:
> 
>   set debug=all
>   ls (hd0,1)/boot

The fs on hd0,1 is xfs. I just did an fsck on it and the fs itself is
fine.

Since it's hard to paste a good amount of code that happens at boot,
here's what I get when running grub-emu from the console with the above
commands. I'll do a reboot later and verify that I get the same errors.
If I see anything different on a regular boot I'll send in a follow-up
email.

One thing that might be potentially useful, when just doing the ls
without the debug=all, I actually get a little bit of output prior to
the out of partition error. In this particular case the output is:

grub> ls (hd0,1)/boot
?^^ ?^^ ^Q^_   
   
   error: out of partition
grub>

Not sure what those extra characters are about, but they are consistent
across multiple runs of grub-emu.

So, running ls after setting debug=all I get:

grub> ls (hd0,1)/boot
--snip--
 /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080210/kern/disk.c:364: 
Reading
 `hd0,1'... 
 /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080210/kern/disk.c:371: Read 
out
 of range: sector 0xef40 (out of partition).
   
 /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080210/kern/disk.c:364: of 
range: sector 0xef40 (out of partition).
--snip--

repeating a few hundred times. There's some other scattered output but
it's very hard to make out. I do see some lines about detecting and
opening the xfs filesystem early in the log.



From: Niels Boehm <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: grub-pc: xfs.mod reads some directories incorrectly
Date: Sat, 28 Jun 2008 08:15:33 +0200

Package: grub-pc
Version: 1.96+20080512-1
Followup-For: Bug #436943


Hi,

grub2 fails for me in the aforementioned manner. It is unable to read
anything from /boot or /boot/grub which are both on my root partition with
an xfs file system.

Trying to ls some directories, I find that some read without problem
(apparently ones containing only a few entries, like / /mnt /media /lib64
for example) and others produce garbled output and the "out of partition"
error (ones with many entries, like /boot /boot/grub /etc /bin for example).

I checked the root fs with /usr/sbin/xfs_check, but it looks alright.

And if I remember correctly, I created the root fs not long ago, so it
should have quite recent data structures. The log being version 2 confirms
that:

# xfs_info /
meta-data=/dev/root  isize=256agcount=4, agsize=64510 blks
 =   sectsz=512   attr=2
data =   bsize=4096   blocks=258040, imaxpct=25
 =   sunit=0  swidth=0 blks
naming   =version 2  bsize=4096
log  =internal   bsize=4096   blocks=1200, version=2
 =   sectsz=512   sunit=0 blks, lazy-count=0
realtime =none   extsz=4096   blocks=0, rtextents=0



From: Niels Boehm <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: grub-pc: missing mapping from fs-block-no. to disk-block-no. in xfs.c
Date: Sat, 28 Jun 2008 14:50:36 +0200

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.c2008-02-02 15:15:31.0 +0100
+++

Re: Sendkey patch

2008-09-03 Thread bitbucket
On Wednesday 03 September 2008, Javier Martín wrote:
> El mié, 03-09-2008 a las 02:08 +0200, phcoder escribió:
> > Hello, again.
> >
> > Javier Martín wrote:
> > > We have 63 sectors = 32256 bytes (sectors range from 0 to 63 and the
> > > first is used by the MBR).
> >
> > I've just rechecked on my system. My first partition begins at sector
> > number 63. This is the value I've seen at most systems. So last usable
> > sector is 62. Sector 0 is MBR. So we have 62 sectors
>
> Oops, true! How strange. So there was no sector 63 in the CHS model and
> that is why the first sector of cyl 1 (the start of the first partition)
> is LBA 63... Does anyone know the historical reasons for this?

Well, the point is, in CHS addressing sector numbering starts with 1, not 0, 
and since there are only 6 bits available for the sector number (the other 2 
being used for cylinder number bits #8 and #9), the maximum number of sectors 
per track in CHS in 63.

Regards,
Niels


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel