Skip to contentSkip to conversation

kernel BUG at inode.c:889!

DISCUSSION Andreas Dilger 1 participant 1 message Jan 31, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 12 lines · I previously

Below is a patch which should fix this. It _should_ prevent you from mounting this filesystem in the first place, and should also stop the BUG in inode.c. I'm not 100% sure of correctness, however:
- is calling clear_inode() in these error cases OK?
- is calling dput() the right thing to do for the root dentry? This is what kill_super() does when cleaning up the filesystem.

Cheers, Andreas
============================================================================

ext2/super.c line 631

Quoted 5 lines
ext2/super.c renamed from ext2/super.c.orig +1 -1
@@ -628,13 +628,19 @@
 	 */
 	sb->s_op = &ext2_sops;
 	sb->s_root = d_alloc_root(iget(sb, EXT2_ROOT_INO));
-	if (!sb->s_root) {
+	if (!sb->s_root || !S_ISDIR(sb->s_root->d_inode) ||

This should be !S_ISDIR(sb->s_root->d_inode->i_mode).

ext2/super.c line 638

Quoted 7 lines
ext2/super.c renamed from ext2/super.c.orig +7 -0
+	    !sb->s_root->d_inode->i_blocks || !sb->s_root->d_inode->i_size) {
+		if (sb->s_root) {
+			dput(sb->s_root);
+			sb->s_root = NULL;
+			printk ("EXT2-fs: corrupt root inode, run e2fsck\n");
+		} else
+			printk ("EXT2-fs: get root inode failed\n");

Cheers, Andreas

Signature · 7 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/