Inode generation number handling.

T V Govind (govind@wipinfo.soft.net)
Sun, 7 Nov 1999 19:29:55 +0530 (IST)


Hi,

Seems there is a problem with the inode generation number handling in
ext2. The problem is when an inode gets reused after a file is created
and later deleted causing it's filesystem inode to get released. Now if
the same inode (on disk) gets reused then the inode generation number
won't properly reflect that the inode does'nt refer to the old file any
longer (the one that was deleted).

CURRENTLY:
In ext2_new_inode() we call get_empty_inode() that clears the
"i_generation" in the inode that it returns. ext2_new_inode() then
increments i_generation before returning to the caller (say
ext2_create()). Now should'nt we be updating the inode generation
number with whats there on disk ??? Else the inode gets a new
generation number which is incorrect.

When we "sync" an inode back to disk then we store the i_generation
value into the disk inode (in ext2_update_inode()). But when a inode is
allocated newly as in ext2_new_inode() while we set up the inode we will
need to set i_generation to the value thats there on disk.

-------------------------------------------
475 inode->i_flags |= MS_SYNCHRONOUS;
476 insert_inode_hash(inode);
477 inode->i_generation++; /* <-- need to set this to the
generation counter on disk ??
478 mark_inode_dirty(inode);
479
480 unlock_super (sb);

-------------------------------------------

Please reply to this email as i am currently not subscribed to this
list.

Govindan

-
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/