linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2()
Date: Tue, 01 Sep 2009 23:59:53 -0600	[thread overview]
Message-ID: <20090902055953.GF4197@webber.adilger.int> (raw)
In-Reply-To: <4A9D9574.3010606@redhat.com>

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.


  reply	other threads:[~2009-09-02  5:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 21:43 [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() Eric Sandeen
2009-09-02  5:59 ` Andreas Dilger [this message]
2009-09-02  6:05   ` Justin Maggard
2009-09-02 16:43     ` Eric Sandeen
2009-09-02 21:02       ` Nick Dokos
2009-09-02 21:28         ` Justin Maggard
2009-09-02 21:31           ` Eric Sandeen
2009-09-02 21:37           ` Nick Dokos
2009-09-02 21:43             ` Eric Sandeen
2009-09-02 21:45               ` Justin Maggard
2009-09-02 22:33                 ` Eric Sandeen
2009-09-02 22:55                   ` Andreas Dilger
2009-09-03  2:41                     ` Eric Sandeen
2009-09-02 22:28         ` Theodore Tso
2009-09-02 23:12           ` Nick Dokos
2009-09-06 16:37         ` [PATCH] Fix counting routines in blknum.c to take/return __u32 counts Theodore Tso
2009-09-06 17:41           ` Nick Dokos
2009-09-06 18:19             ` Theodore Tso
2009-09-06 16:30 ` [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090902055953.GF4197@webber.adilger.int \
    --to=adilger@sun.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).