fixunix
Tags Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

[PATCH] ext4: issue warning when bad inode found via ext4_lookup - Kernel

This is a discussion on [PATCH] ext4: issue warning when bad inode found via ext4_lookup - Kernel ; I have a hand-crafted bad filesystem image which has corruption: [root @ inode ~]# ls mnt/dir file1 file2 file3 file4 file5 [root @ inode ~]# ls mnt/dir/file4 ls: cannot access mnt/dir/file4: No such file or directory [root @ inode ~]# ...


Fix Unix > Linux > Help > Kernel > [PATCH] ext4: issue warning when bad inode found via ext4_lookup

Reply
 
LinkBack Tools
  #1  
Old 12-14-2007, 05:50 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default [PATCH] ext4: issue warning when bad inode found via ext4_lookup

I have a hand-crafted bad filesystem image which has corruption:

[root@inode ~]# ls mnt/dir
file1 file2 file3 file4 file5
[root@inode ~]# ls mnt/dir/file4
ls: cannot access mnt/dir/file4: No such file or directory
[root@inode ~]# ls -l mnt/dir
ls: cannot access mnt/dir/file4: No such file or directory
total 8
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 file1
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 file2
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 file3
d????????? ? ? ? ? ? file4
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 file5

e2fsck also knows it's corrupted:
Pass 2: Checking directory structure
Entry 'file4' in /dir (2049) has deleted/unused inode 13. Clear? no

Entry 'file4' in /dir (2049) has an incorrect filetype (was 2, should be 1).
Fix? no

Pass 3: Checking directory connectivity
Unconnected directory inode 2053 (/dir/???)

BUT there are no kernel messages logged anywhere because ext4_read_inode
silently makes a bad_inode in this case, so that stale NFS filehandles
aren't noisy. However, when we encounter such a problem after a by-name
lookup, I think a warning is appropriate, as it indicates filesystem
corruption.

Signed-off-by: Eric Sandeen ---

Index: linux-2.6.24-rc3/fs/ext4/namei.c
================================================== =================
--- linux-2.6.24-rc3.orig/fs/ext4/namei.c
+++ linux-2.6.24-rc3/fs/ext4/namei.c
@@ -1050,6 +1050,9 @@ static struct dentry *ext4_lookup(struct
return ERR_PTR(-EACCES);

if (is_bad_inode(inode)) {
+ ext4_warning(inode->i_sb, __FUNCTION__,
+ "bad inode %lu in dir #%lu",
+ inode->i_ino, dir->i_ino);
iput(inode);
return ERR_PTR(-ENOENT);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Reply With Quote
Reply

Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PATCH, RFC] ext4: Use preallocation when reading from the inode table unix Kernel 8 09-25-2008 11:50 PM
[PATCH 3/6] ext4: don't inherit inappropriate inode flags from parent unix Kernel 1 06-19-2008 03:50 PM
[PATCH 3/3] ext4: don't inherit inappropriate inode flags from parent unix Kernel 0 06-04-2008 01:00 PM
[PATCH] ext3: issue warning when bad inode found via ext3_lookup unix Kernel 0 12-14-2007 05:50 PM
[PATCH] ext4: dir inode reservation V3 unix Kernel 10 11-21-2007 02:20 AM


All times are GMT. The time now is 10:02 AM.