Using ilookup?

From: Charles Manning
Date: Tue Oct 12 2004 - 20:41:03 EST


Hi

I'm the maintainer for YAFFS, the NAND-specific file system used in many
mobile/embedded Linux devices over the last two years.

There is a problem that I'm unsure how to best fix. I thought perhaps using
ilookup might be a good idea, but I see a big fat warning that ilookup is
perhaps not the function to be using. I therefore seek help.

YAFFS allocates its own "objectId"s which are used as inode numbers for most
purposes. When objects get deleted (== unlinked), the object numbers get
recycles. Sometimes though the Linux cache has an inode after the object has
been deleted. Then if that object id gets recycled before the cached inode is
released, a problem occurs since iget() gets the old inode instead of
creating a new one. We then end up with an inconsistency.

Someone has been able to force this by doing the following:
# cd /test; rm -rf /test

I think I need to do one of two things:

1) Somehow plug myself into the inode iput() chain so that I know when an
inode is removed from the cache. I can then make sure that I don't free up
the inode number for reuse until the inode is not in the cache. Any hints on
how to do that?

2) When creating inode numbers, I could test for if there is a corresponding
inode in the cache first and just not recycle that number if there is. To do
this is ilookup the correct/safe thing to do?

2') A further issue here is that ilookup is not available in some older 2.4.x
versions. Is it Ok to just patch the ilookup code in, say, 2.4.27 back into
earlier versions (say 2.4.18 which seems a popular vintage for embedded stuff
for some reason or other).


Thanx

-- Charles


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