From: Daniel Phillips <phillips@bonn-fries.net>
To: Andreas Dilger <adilger@turbolinux.com>
Cc: phillips@bonn-fries.net,
Linux kernel development list <linux-kernel@vger.kernel.org>,
Alexander Viro <viro@math.psu.edu>
Subject: Re: [PATCH][CFT] (updated) ext2 directories in pagecache
Date: Fri, 11 May 2001 15:02:03 +0200 [thread overview]
Message-ID: <01051115020302.01913@starship> (raw)
In-Reply-To: <200105110710.f4B7ArA9001543@webber.adilger.int>
In-Reply-To: <200105110710.f4B7ArA9001543@webber.adilger.int>
On Friday 11 May 2001 09:10, Andreas Dilger wrote:
> and previously wrote:
> > OK, here are the patches described above.
> >
> > Unfortunately, they haven't been tested. I've given them several
> > eyeballings and they appear OK, but when I try to run the ext2
> > index code (even without "-o index" mount option) my system
> > deadlocks somwhere inside my ext2i module (tight loop, but SysRQ
> > still works). I doubt it is due to these patches, but possibly
> > because I am also working on ext3 code in the same kernel. I'm
> > just in the process of getting kdb installed into that kernel so I
> > can find out just where it is looping.
>
> I've tested again, now with kdb, and the system loops in
> ext2_find_entry() or ext2_add_link(), because there is a directory
> with a zero rec_len. While the actual cause of this problem is
> elsewhere, the fact that ext2_next_entry() will loop forever with a
> bad rec_len is a bug not in the old ext2 code.
>
> I have changed ext2_next_entry() to verify rec_len >
> EXT2_DIR_REC_LEN(0), and added a helper function ext2_next_empty()
> which is nearly the same, but it follows the de links until it finds
> one with enough space for a new entry (used in ext2_add_link()). The
> former is useful for both Al and Daniel's code, while the latter may
> only be useful for Daniel's.
Al already answered this, but I'll amplify. Al keeps a bit in the page
state that tells you if a page in the page cache has been 'checked'
since it was entered into the cache, allowing his code to carry out a
careful, expensive check that is performed only once per cache page
lifetime. This will pick up bad data coming from disk, and we assume
that newly created entries have been created correctly. It's an
interesting idea, but note his comment that 'this should die early'.
I'm torn on that, it's hard to think of a cuter way of doing this.
We could use the same strategy in ext2_getblk, and in fact use the same
check_page code, providing the PG_checked bit is going to stay.
> However, the way that I currently fixed ext2_next_entry() is probably
> not very safe. If it detects a bad rec_len, we should probably not
> touch that block anymore, but it currently just makes it look like
> the block is empty. That may lead to deleting the rest of the
> directory entries in the block, although this is what e2fsck does
> anyways... I at least need to set the error flag in the
> superblock... Next patch.
We can set the PG_error flag on the page, then we get the complaint
just once per mount (typically, unless you have cache pressure, then
you probably want to get lots of complaints).
> I spotted another bug, namely that when allocating a new directory
> page it sets rec_len to blocksize, but does not zero the inode
> field... This would imply that we would skip a bogus directory entry
> at the start of a new page.
The block is supposed to be zeroed when created. I think I did that
correctly in ext2_getblk. This at least deserves a comment.
> As yet I haven't found the cause of the real bug, but at least now my
> kernel doesn't lock up on (relatively common) bogus data.
Yep, this counts as 'bullet proofing'.
--
Daniel
next prev parent reply other threads:[~2001-05-11 13:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-11 7:10 [PATCH][CFT] (updated) ext2 directories in pagecache Andreas Dilger
2001-05-11 7:19 ` Alexander Viro
2001-05-11 16:34 ` Andreas Dilger
2001-05-11 20:20 ` Daniel Phillips
2001-05-12 21:41 ` Andreas Dilger
2001-05-12 22:18 ` Alexander Viro
2001-05-13 2:13 ` Daniel Phillips
2001-05-13 2:34 ` Daniel Phillips
2001-05-14 18:33 ` Andreas Dilger
2001-05-14 19:29 ` Daniel Phillips
2001-05-14 21:50 ` Daniel Phillips
2001-05-16 3:11 ` Daniel Phillips
2001-05-11 13:02 ` Daniel Phillips [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-05-10 20:53 Andreas Dilger
2001-05-11 1:10 ` Daniel Phillips
2001-05-10 7:21 Andreas Dilger
2001-05-13 22:15 ` Daniel Phillips
2001-05-14 20:04 ` Andreas Dilger
2001-05-14 22:18 ` Daniel Phillips
2001-05-14 22:23 ` Daniel Phillips
2001-05-06 23:16 Daniel Phillips
2001-05-09 21:22 ` Andreas Dilger
2001-05-11 1:04 ` Daniel Phillips
2001-05-03 21:10 Daniel Phillips
2001-05-03 22:59 ` Albert Cranford
[not found] <01050303150500.00633@starship>
2001-05-03 1:43 ` Daniel Phillips
2001-04-29 20:35 Daniel Phillips
2001-05-02 3:03 ` Albert Cranford
2001-04-12 16:33 [PATCH][CFT] " Alexander Viro
2001-04-23 22:21 ` [PATCH][CFT] (updated) " Alexander Viro
2001-04-28 18:16 ` Alexander Viro
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=01051115020302.01913@starship \
--to=phillips@bonn-fries.net \
--cc=adilger@turbolinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@math.psu.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