public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tytso@mit.edu
To: Paul Allen <allenp@nwlink.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Ext2 zeros inode in directory entry when deleting files.
Date: Sun, 17 Mar 2002 02:25:05 -0500	[thread overview]
Message-ID: <20020317072505.GA768@snap.thunk.org> (raw)
In-Reply-To: <3C93012F.9080601@nwlink.com>
In-Reply-To: <3C93012F.9080601@nwlink.com>

On Sat, Mar 16, 2002 at 12:24:15AM -0800, Paul Allen wrote:
> While helping a friend recover from a catastrophic "rm -rf" accident,
> I discovered that deleted files have the inode number in their old
> directory entries zeroed.  This makes it impossible to match file
> names with recovered files.  I've verified this behavior on Mandrake
> 8.1 with Mandrake's stock 2.4.8 kernel.  In my kernel sources and
> in the stock 2.4.8 sources, the function ext2_delete_entry() in
> fs/ext2/dir.c has this line:
> 
> 	dir->inode = 0;
> 
> Now, I'm tempted to comment the line out in my kernel and see
> what happens.  But it does occur to me that hackers with more
> experience than I may zeroing the inode number for a reason and
> may be depending on it elsewhere in the kernel.  Or perhaps the
> ext2 flavor of fsck will malfunction if deleted directory entries
> have a non-zero inode?

Um....  the way directory entries are marked as deleted is by zeroing
out the inode number.

So if you take out that line, deleted files will appear not to be
deleted, the kernel will get confused, and you can be sure that fsck
will complain.

						- Ted

  parent reply	other threads:[~2002-03-17  7:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-16  8:24 Ext2 zeros inode in directory entry when deleting files Paul Allen
2002-03-16  9:02 ` Alexander Viro
2002-03-17  7:25 ` tytso [this message]
2002-03-17 17:21   ` Oliver Xymoron
2002-03-17 18:17     ` Mark Mielke
2002-03-17 21:20       ` Oliver Xymoron
2002-03-17 23:53         ` Mark Mielke
2002-03-19  0:50           ` Paul Allen
2002-03-19  1:34             ` Andreas Dilger

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=20020317072505.GA768@snap.thunk.org \
    --to=tytso@mit.edu \
    --cc=allenp@nwlink.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox