Re: fs inode lookup

Jan Kara (jack@atrey.karlin.mff.cuni.cz)
Sat, 21 Nov 1998 11:31:30 +0100


Hello.

> > > So my questions are:
> > >
> > > 1. Is there any generic way using vfs? I didn't find any...
> > I don't know any. You can only read inode using iget() and then determine
> > somehow whether it is deleted (in ext2 using dtime would be enough IMHO).
>
> That's where I got stuck. dtime is not always reliable - or why do I get
> zero dtime complains on fsck? How does ext2 detect a deleted inode?
>
> Anyway, if dtime is set, I will treat the inode as deleted, if it's 0, no
> harm will be done by keeping an entry for this inode.
>
As someone already said here - the link count is 0. The problem is that
when you delete a file and somebody has it open its link count is set
to 0 (and the directory entry is deleted) but the file is deleted after
it is closed. At that time is also set dtime. So it can happen that
link count is set to 0 but dtime not (it happened in some kernels that
fs could be unmounted even if there were some files open..) and fsck
complains about this inconsistency...

Goodbye, Honza.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/