Problem with deleted files

Simon Munton Simon.Munton at m4data.co.uk
Fri Jan 26 08:38:53 EST 2001


Hi,

Consider the following:

Create a file for writing
Unlink it, but don't close it
Write lots of data to the file, so that some nodes get written to the next
flash erase sector
Close it
Use the filesystem enough until the flash sector containing the delete node
is erased.
Unmount the filesystem.

The flash now contains nodes for the file that was deleted, but the node
that says the file was deleted has gone. when remounting the file system,
the file will reappear. (If the file was in a directory that was also
deleted, the mount will fail:'Found inode with no parent and pino'.)

This could be fixed by always setting a node's deleted flag if the
corresponding file's deleted flag is set, when it is written in
jffs_write_node() and jffs_rewrite_data(). Can anyone see any problems with
this?

Should the filesystem fail to mount if it finds a node with no parent? Would
it be better to just throw away such nodes, or perhaps create a virtual
lost+found directory and put them there?

Simon


To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org



More information about the linux-mtd mailing list