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

Andreas Dilger wrote:
> On Nov 14, 2006  09:25 -0600, Eric Sandeen wrote:
>> has an image with a corrupt directory inode - despite having only 4 blocks, 
>> it has an extremely large i_size.
>>
>> It seems odd to me that readdir bails out with an error on the first bad 
>> page, while lookup keeps trying.  Shouldn't these be consistent?  And if 
>> so, which is the desired behavior?
> 
> I'd prefer that readdir _should_ return all of the valid directory blocks
> it can find.  Otherwise, it makes on average 1/2 of the files in that dir
> inaccessible.

in the very rare case of corruption, yes... although if ext2 is mounted
with anything other than errors=continue the fs is going to turn
somewhat useless shortly thereafter anyway.

>> Or, perhaps a check high up that says if i_size doesn't correlate to 
>> i_blocks, this inode is corrupt, and bail out early.
> 
> We did that for ext3, no?  

Yes, this is similar.  In that case we kept trying bad pages until we
had exceeded the block count, IIRC.  I was considering the possibility
of checking blocks vs. size right at the top (ext3_readdir or lookup)
and if they don't correspond, don't even bother because the information
we're starting with is known to be bad.

Looking at this one I wonder if the ext3 fix was too specific/targeted -
I'll double check it.

> 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...)

-Eric

  reply	other threads:[~2006-11-14 19:38 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 [this message]
2006-11-14 20:44     ` Andreas Dilger

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=455A1B1C.4070705@redhat.com \
    --to=sandeen@redhat.com \
    --cc=adilger@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).