[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug of IMFS_unlink ?



Hi,

I suspect there is a bug with unlink of IMFS files, but I am not certain.

If a file is still being opened, IMFS_unlink will not really free the
file node, but just decrements its link count and removes it from the
parent's chain, and the remaining work is leaved to close.
memfile_close calls memfile_check_rmnod to delete the file node with a
zero link count when the last user closes the file.

However, in memfile_check_rmnod "rtems_libio_is_file_open" is checked,
which it will always be TRUE because the LIBIO_FLAGS_OPEN flag bit has
not been cleared yet. Hence, the file node will never be deleted,
while it can no more be accessed in the file system.

I also wonder why device_close and imfs_dir_close do not do similar
rmnod checks as memfile_close.

Regards,
Wei