Re: 2.4.0-test8-pre1 is quite bad / how about integrating Rik's VM now?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sat Sep 02 2000 - 15:58:57 EST


In article <8ornsg$h70$1@osiris.storner.dk>,
Henrik =?ISO-8859-1?Q?St=F8rner?= <henrik@storner.dk> wrote:
>
>I am one of the people who have been seeing this problem. I would be
>very surprised if it was an ext2 problem, as the only ext2 filesystem
>on my disk contains all of /boot. No programs, no news spool on ext2 -
>nada. I use reiserfs for all of that.

It may be that the problem exists on other filesystems: the ext2 bug was
that when truncating a file, the last (partial) block of a file would
not be truncated (ie last part of the block zeroed out) on-disk. We
screwed that up when we did the new page-cache stuff, and people that
looked at what ext2 did may have inadvertedly introduced the same bug in
other filesystems (eg reiserfs).

This is often hidden by the fact that when it _is_ truncated in memory,
that truncated copy often ends up being dirty and written back to disk
anyway, so a lot of the trivial test-programs were entirely unable to
show this behaviour, because they hid the bug by having tmp-files that
were dirty and in-memory and pending to be written out anyway.

Hmm.. Looking at the test8-pre2 patches, that case is not actually
fixed yet - it only has the "preparation" patch for the final thing.
Al? Can you send out the final part too?

Anyway, the way to test if you have the bug is this simple program from
Al Viro who noticed the bug and has the fix - notice that you need to
have some file that is clean, non-zero and NOT in memory (ie an old
forgotten /tmp entry that can be happily trashed by the test-program):

        main(argc,argv)
        int argc;
        char *argv[];
        {
                int fd;
                char dummy = '\0';
                truncate(argv[1], 1); /* everything but the first byte must die */
                fd = open(argv[1], 1);
                lseek(fd, 8192, 0); /* past the first block */
                write(fd, &dummy, 1); /* now reading from offsets 1--8192 should */
                                        /* yield zeroes */
                close(fd);
        }

and then do

        ./a.out /tmp/file-to-be-trashed
        od /tmp/file-to-be-trashed

If you have the bug even on reiserfs, you'll get tons of old stuff
between offsets 1-8192. If the bug is not there, you'll get zeroes like
the comment says you should.

                Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:14 EST