I have a hand-crafted bad filesystem image which has a corrupted directory
entry:

[EMAIL PROTECTED] ~]# ls mnt/Picture
LINKS_20  OBEN_20  VORNE_20  VORN_LINKS_20  VORN_RECHTS_20
[EMAIL PROTECTED] ~]# ls mnt/Picture/VORN_LINKS_20 
ls: cannot access mnt/Picture/VORN_LINKS_20: No such file or directory
[EMAIL PROTECTED] ~]# stat mnt/Picture/VORN_LINKS_20 
stat: cannot stat `mnt/Picture/VORN_LINKS_20': No such file or directory
[EMAIL PROTECTED] ~]# ls -l mnt/Picture
ls: cannot access mnt/Picture/VORN_LINKS_20: No such file or directory
total 8
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 LINKS_20
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 OBEN_20
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 VORNE_20
d????????? ? ?    ?       ?                ? VORN_LINKS_20
drwxr-xr-x 2 root root 1024 2007-09-04 13:36 VORN_RECHTS_20

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

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

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

BUT there are no kernel messages anywhere.

I think the below makes sense; I don't think there are any instances where an
inode found via a filename passed to ext3_lookup should be returning a bad inode
without warning; NFS may pass in a stale filehandle which also makes a bad 
inode, 
but that shouldn't go through lookup...

Comments?  (if it looks good I'll resubmit for ext*_lookup)

Signed-off-by: Eric Sandeen <[EMAIL PROTECTED]>

---

Index: linux-2.6.24-rc3/fs/ext3/namei.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/ext3/namei.c
+++ linux-2.6.24-rc3/fs/ext3/namei.c
@@ -1049,6 +1049,10 @@ static struct dentry *ext3_lookup(struct
                        return ERR_PTR(-EACCES);
 
                if (is_bad_inode(inode)) {
+                       ext3_warning(inode->i_sb, __FUNCTION__,
+                                  "bad inode %lu for file %s in dir #%lu",
+                                  inode->i_ino, dentry->d_name.name,
+                                  dir->i_ino);
                        iput(inode);
                        return ERR_PTR(-ENOENT);
                }

-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to