Re: ext2 filesystem corruption?!?!??

tytso@mit.edu
Wed, 9 Apr 1997 21:56:00 -0500


From: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>
Date: Sat, 5 Apr 1997 22:43:08 +0100

Maybe I'm missing things, but I couldn't see any way for a locked
inode to get chosen in get_empty_inode the way things stand: the "goto
found_good" shortcut only runs if inode is already known to be
unlocked, unreferenced and clean.

In the for loop, if all inodes are locked or dirty, then the "best"
inode can be locked. See the for loop and consider what happens if for
all inodes, they are locked or dirty....

Ted, I think this is still insufficient. There is still a race if the
inode is locked. The problem is that if clear_inode() has to wait for
the inode to become unlocked, then once the inode becomes unlocked
again there is no guarantee about which process is going to grab the
inode next. It is quite possible that between calling lock_inode()
and the call returning, somebody else has reused the inode.

Good point; I hadn't thought of this.

- Ted