I understand what you want. You want the temporary file to act sort of like
virtual memory. It would get swapped out to disk only if physical memory got
tight. I understand that Linux does this fairly well for files which only exist
for a few seconds. You are probably right, lazy writing kicks in and commits
the changes to disk.
Your belief that this shouldn't happen if the file has already been deleted
sounds reasonable. I think the reason it doesn't work is due to Unix unlink
semantics. To be precise, unlink() does _not_ delete a file. Rather, a file is
deleted when unlink() has been used sucessfully on all its names and all
processes have closed it. Thus, technically, in your example, the file has not
been deleted, so the kernel is right to commit it to disk. Of course, there is
probably no way to establish new links (names) for the file, so this is sort of
silly.
I don't know if this behavior should be changed or if there are more
appropriate kinds of virtual memory to use for your purpose.
-
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/