grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] biosdisk / open_device() messing up offsets


From: Pavel Roskin
Subject: Re: [PATCH] biosdisk / open_device() messing up offsets
Date: Tue, 10 Jun 2008 18:58:15 -0400

On Wed, 2008-06-11 at 02:51 +0800, Bean wrote: 
> Hi,
> 
> I spot another bug, please try the new patch.

You probably meant to use (LOG2_EXT2_BLOCK_SIZE (data) + 9) in your
patch because the block size is in 512 bytes units, unlike sizeof:

diff --git a/fs/ext2.c b/fs/ext2.c
index e4ce47b..fb13a80 100644
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -260,8 +260,8 @@ grub_ext2_blockgroup (struct grub_ext2_data *data, int 
group,
   int blkno, blkoff;
 
   group *= sizeof (struct grub_ext2_block_group);
-  blkno = group >> LOG2_EXT2_BLOCK_SIZE (data);
-  blkoff = group  - (blkno << LOG2_EXT2_BLOCK_SIZE (data));
+  blkno = group >> (LOG2_EXT2_BLOCK_SIZE (data) + 9);
+  blkoff = group - (blkno << (LOG2_EXT2_BLOCK_SIZE (data) + 9));
 
   return grub_disk_read (data->disk,
                         (grub_fshelp_map_block (data->journal,

That appears to fix everything!!!  grub-fstest is loading, GRUB is
working in qemu on the live filesystem, and the normal boot is still
working.

I think we should consider having a journaling layer above
grub_disk_read() that would do the substitution and avoid such bugs in
the future.

-- 
Regards,
Pavel Roskin




reply via email to

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