[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: incorrect handling of holes in ext2 files
From: |
Jason Thomas |
Subject: |
Re: incorrect handling of holes in ext2 files |
Date: |
Sat, 7 Aug 2004 01:56:30 +1000 |
User-agent: |
Mutt/1.5.6+20040722i |
This fix looks fine to me. Anyone see a problem? If not I'll upload it!
On Thu, Aug 05, 2004 at 02:41:57PM -0700, Michael Hohnbaum wrote:
> Grub is not correctly handling holes in files in ext2 filesystems.
> The current code in stage2/fsys_ext2fs.c does not check upon
> return from ext2fs_block_map() if a zero was returned. Rather,
> it happily reads in block zero from the filesystem. Most of
> the time this works alright as block 0 tends to be sparsely
> populated. However, it does not contain all zeroes and the
> extra bits can lead to problems.
>
> This problem goes away with reiserfs. I've not tried other filesystems.
>
> I've ran into this problem on multiple machines with various versions
> of Linux including:
> P3 based machines with RedHat 8, SuSE SLES 9, Fedora Core 1
> P4 based machine with Debian
> Athlon64 machine with Fedora Core 2
>
> Grub versions have included 0.92 and 0.95.
>
> The following patch against 0.95 solves this problem. Any chance this,
> or something similar can be applied for the next release?
>
> --- grub-0.95.orig/stage2/fsys_ext2fs.c 2003-12-30 04:34:03.000000000
> -0800
> +++ grub-0.95/stage2/fsys_ext2fs.c 2004-08-05 13:37:07.000000000
> -0700
> @@ -432,12 +432,16 @@
> if (size > len)
> size = len;
>
> - disk_read_func = disk_read_hook;
> + if ( map == 0 ) {
> + memset ((char *) buf, 0, size);
> + } else {
> + disk_read_func = disk_read_hook;
>
> - devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
> + devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
> offset, size, buf);
>
> - disk_read_func = NULL;
> + disk_read_func = NULL;
> + }
>
> buf += size;
> len -= size;
>
>
> --
>
> Michael Hohnbaum 503-578-5486
> address@hidden T/L 775-5486
>
>
>
>
> _______________________________________________
> Bug-grub mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-grub
--
Jason Thomas
Linux System Administrator
Planet Netcom P/L
Scanned by PeNiCillin http://safe-t-net.pnc.com.au/