Message ID | 4A9D9574.3010606@redhat.com |
---|---|
State | Accepted, archived |
Headers | show |
On Sep 01, 2009 16:43 -0500, Eric Sandeen wrote: > ext2fs_open2() was only looking at s_blocks_count, and > when it wrapped to a low number, it was failing the test of: > > fs->super->s_first_data_block >= fs->super->s_blocks_count > > which made the superblock look corrupt. Is this the source of the "e2fsck is finding bad checksums" problem? > Patch is against the pu branch > > Index: e2fsprogs/lib/ext2fs/openfs.c > =================================================================== > --- e2fsprogs.orig/lib/ext2fs/openfs.c > +++ e2fsprogs/lib/ext2fs/openfs.c > @@ -288,7 +288,7 @@ errcode_t ext2fs_open2(const char *name, > blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) || > fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) || > EXT2_DESC_PER_BLOCK(fs->super) == 0 || > - fs->super->s_first_data_block >= fs->super->s_blocks_count) { > + fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) { I would strongly suggest to replace the declaration of "s_blocks_count" with "s_blocks_count_lo" (and similar for every other split value), so that we catch all instances of this type of bug. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Sep 1, 2009 at 10:59 PM, Andreas Dilger<adilger@sun.com> wrote: > On Sep 01, 2009 16:43 -0500, Eric Sandeen wrote: >> ext2fs_open2() was only looking at s_blocks_count, and >> when it wrapped to a low number, it was failing the test of: >> >> fs->super->s_first_data_block >= fs->super->s_blocks_count >> >> which made the superblock look corrupt. > > Is this the source of the "e2fsck is finding bad checksums" problem? I applied this earlier today, and it didn't appear to help in my test case. -Justin -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Justin Maggard wrote: > On Tue, Sep 1, 2009 at 10:59 PM, Andreas Dilger<adilger@sun.com> wrote: >> On Sep 01, 2009 16:43 -0500, Eric Sandeen wrote: >>> ext2fs_open2() was only looking at s_blocks_count, and >>> when it wrapped to a low number, it was failing the test of: >>> >>> fs->super->s_first_data_block >= fs->super->s_blocks_count >>> >>> which made the superblock look corrupt. >> Is this the source of the "e2fsck is finding bad checksums" problem? > > I applied this earlier today, and it didn't appear to help in my test case. > > -Justin Nah, didn't expect it to, but I'm working towards that. Just have to whack down the bugs between where I am, and your bug ;) -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Sep 01, 2009 at 04:43:16PM -0500, Eric Sandeen wrote: > ext2fs_open2() was only looking at s_blocks_count, and > when it wrapped to a low number, it was failing the test of: > > fs->super->s_first_data_block >= fs->super->s_blocks_count > > which made the superblock look corrupt. > > Signed-off-by: Eric Sandeen <sandeen@redhat.com> Added to the e2fsprogs 64-bit patch set / pu branch. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: e2fsprogs/lib/ext2fs/openfs.c =================================================================== --- e2fsprogs.orig/lib/ext2fs/openfs.c +++ e2fsprogs/lib/ext2fs/openfs.c @@ -288,7 +288,7 @@ errcode_t ext2fs_open2(const char *name, blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) || fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) || EXT2_DESC_PER_BLOCK(fs->super) == 0 || - fs->super->s_first_data_block >= fs->super->s_blocks_count) { + fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup; }
ext2fs_open2() was only looking at s_blocks_count, and when it wrapped to a low number, it was failing the test of: fs->super->s_first_data_block >= fs->super->s_blocks_count which made the superblock look corrupt. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- Patch is against the pu branch -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html