All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH, RFC] - issue warning when bad inode found via ext3_lookup
Date: Thu, 13 Dec 2007 14:03:19 -0600	[thread overview]
Message-ID: <47619007.2070206@redhat.com> (raw)

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

[root@inode ~]# ls mnt/Picture
LINKS_20  OBEN_20  VORNE_20  VORN_LINKS_20  VORN_RECHTS_20
[root@inode ~]# ls mnt/Picture/VORN_LINKS_20 
ls: cannot access mnt/Picture/VORN_LINKS_20: No such file or directory
[root@inode ~]# stat mnt/Picture/VORN_LINKS_20 
stat: cannot stat `mnt/Picture/VORN_LINKS_20': No such file or directory
[root@inode ~]# 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 <sandeen@redhat.com>

---

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);
 		}

                 reply	other threads:[~2007-12-13 20:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47619007.2070206@redhat.com \
    --to=sandeen@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.