Re: Bad FS behavior w/ testcase

From: Matija Nalis (mnalis-j@voyager.hr)
Date: Wed Mar 29 2000 - 05:59:46 EST


On 28 Mar 2000 12:58:48 +0200, James Lewis Nance <jlnance@worldnet.att.net> wrote:
>--OgqxwSJOaUobr8KG
>Content-Type: text/plain; charset=us-ascii
>
>Hello All,
> I have found an annoying problem with the way linux handles dirty pages
>of unlinked files. The attached testcase makes a file, unlinks it, and
>dirties 64M of its pages. The program then prints a message and calls
>_exit(). You will notice a long delay between this message appearing and
>when you get your shell prompt back. AFAICT, this delay is due to the
>process writting the dirty pages back to the file. Now since the file has
>been unlinked there is no need to write these pages back, but it looks like
>linux does not know this. Any comments?
>
>int main()
>{
> int fd = open(FILENAME, O_RDWR | O_CREAT | O_TRUNC, 0600);
> if(fd>0) {
> unlink(FILENAME); /* The file is gone */

No, the file is not gone. Specific named reference to file is gone.

There could be more references to the same file (same inode). There could be
more processes that have that file opened and want to read/write from it.
Even this same process may want to seek on this file and read something it
had written before.

IOW, everything is just exactly as it should be.

-- 
Opinions above are GNU-copylefted.

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:24 EST