linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: ext2 readdir/lookup/check_page behavior
Date: Tue, 14 Nov 2006 13:44:25 -0700	[thread overview]
Message-ID: <20061114204425.GT6012@schatzie.adilger.int> (raw)
In-Reply-To: <455A1B1C.4070705@redhat.com>

On Nov 14, 2006  13:38 -0600, Eric Sandeen wrote:
> Andreas Dilger wrote:
> > It would make sense to fix ext2 in the same way.
> > I'd suggest bailing out "early" == min(i_size >> blocksize, i_blocks).
> > The i_blocks count is an upper limit, because it includes the overhead of
> > indirect blocks.  Directories cannot be sparse.
> 
> so we could either a) keep processing pages based on i_size, until we
> have passed i_blocks, or b) if i_size & i_blocks don't match,
> immediately bail out because we know we have found a corrupted inode
> (vs. a "normal" unreadable block...)

Do we already ext3_error() in this case?  That allows the admin to determine
the behaviour already.  If it is errors=continue or errors=remount-ro then
we should continue I think.  We might consider the inode fatally corrupted

	if (i_blocks << 9 < i_size ||
	    i_blocks > i_size >> (blockbits - 8) + /* blocks */
	    i_size >> (blockbits * 2 - 8 - 2) + /* indirect */
	    i_size >> (blockbits * 3 - 8 - 2) + /* dindirect */
	    i_size >> (blockbits * 4 - 8 - 2))  /* tindirect */

I think... Trying to account for indirect blocks.  It is already given a
100% margin (-8 instead of -9) to cover rounding, EA blocks, some small
bugs in block counting, extents format, etc.  FYI, the "-2" is 4 bytes/addr.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

      reply	other threads:[~2006-11-14 20:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-14 15:25 ext2 readdir/lookup/check_page behavior Eric Sandeen
2006-11-14 19:21 ` Andreas Dilger
2006-11-14 19:38   ` Eric Sandeen
2006-11-14 20:44     ` Andreas Dilger [this message]

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=20061114204425.GT6012@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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).