Re: Inode problem

Martin von Loewis (martin@mira.isdn.cs.tu-berlin.de)
Fri, 9 Jan 1998 09:20:05 +0100


> If between theses 2 ops. there is aafaiulure, I guess the inode is
> allocated on disk but cannot be accessed thru dir.
>
> So how can we access this inode?

You have to invoke e2fsck. This will go over the entire disk, and
locate the inode which is not connected to a directory. It will
then recover the inode, and put it into lost+found if appropriate.

> Can anyone direct me to the appropriate kernel code for this ...

Looking at fs/ext2/namei.c:ext2_create, you can see that the inode
is allocated with ext2_new_inode. Then, the directory is modified with
ext2_add_entry. Finally, if in synchronous mode, create waits for
the directory be written back to disk.

In asynchronous mode, the disk driver might chose to write back
in a different order, so all other kinds of corruptions might happen.

Regards,
Martin