[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Undelete?


On Thu, Mar 15, 2001 at 10:59:29AM -0500, Theodore Tso wrote:

> Yeah, this is the real problem.  Fixing this so that ext3 doesn't
> clear the direct and indirect blocks when it's truncating a file which
> is about to be unlinked may be somewhat non-trivial, however.  Stephen?

The problem is that ext3 has to keep track of all sorts of information
about buffers which are dirty but not yet committed to disk, and
discarding buffers on delete when those buffers may already be queued
for write to disk disrupts that.  

This is particularly bad on 2.2 kernels, where the whole truncate()
logic is very, very sensitive to races indeed.  truncate on 2.2 is
basically insanely fragile.  It is illegal to go to sleep at several
critical places during truncate, and we cannot take the journal locks
without risking going to sleep, and we cannot discard the block safely
without taking the journal lock to make sure that no other process is
in the middle of flushing out the block.

The 2.4 kernel is much more robust: its truncate mechanism removes
entire branches from the inode before freeing the blocks inside those
branches one by one, so the removal of blocks from the inode data
structure is easier to do atomically and by the time we get to
discarding the blocks we know that there is no problem about going to
sleep: nobody else can get another handle on the blocks while we

So, adding the proper discarding of truncated indirect blocks is on
the agenda for the 2.4 port, but I don't think it will ever happen for


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]