Subject: Re: (absence of) duplicated inodes
To: jason downs <downsj@CSOS.ORST.EDU>
From: Duncan McEwan <duncan@Comp.VUW.AC.NZ>
List: current-users
Date: 09/22/1994 18:56:31
> following mycroft's advice, i turned off doreallocblks. i then built
> X11, which usually causes a couple of FS problems. they didn't happen,
> this time.

Unfortunately I can't report the same good results.  I edited vfs_cluster.c to
turn off doreallocblks, built (using sources supped yesterday) and booted a new
kernel and then ran a perl script I wrote that previously relatively reliably
triggered FS corruption.  It still does... :-(

I've enclosed a copy of the script on the off-chance that someone else who has
been having this problem might like to try running it.  Note: I accept no
responsibility for any damage to file systems that this script causes!


--- cut here ---

# Running this script on my netbsd 1.0-beta system, on an i386 eventually (it
# varies, but usually in less than half an hour) results in a newly copied
# file and the file it was copied from being different (as detected by cmp),
# indicating some form of file system corruption has occured.


# None of the directories in the following list can have subdirectories,
# otherwise the wildcard expansion messes up.
@srclist = (`ls /usr/bin/* /usr/sbin/* /usr/X386/bin/*`);

# Create the following directories.  If you want to give your disk a really
# good work out, you could create them in different parts of the file system,
# increasing the chance that they will end up in different cylinder groups,
# thus causing more head movement...
@dstdirs = ("test1", "test2", "test3");

for (;;) {

        $sleeptime = int (rand (3));
        $delaytime = int (rand (25)) + 1;

        # pick random src
        $fileindex = int (rand ($#srclist + 1));
        chop($srcfile = $srclist[$fileindex]);
        ($dir, $file) = $srcfile =~ m?(/.*)/([^/]+)?;

        # pick random destination
        $dstindex = int (rand ($#dstdirs + 1));
        $randext  = int(rand(32767));
        $dstfile  = "$dstdirs[$dstindex]/$file.$randext";

        $cmd = "(cp $srcfile $dstfile; " .
                "if cmp $srcfile $dstfile; then " .
                    "sleep $delaytime; rm $dstfile; " .
                "else " .
                    "echo \007Done!!!; kill $$;" .
                "fi) &";


        print "cp $srcfile -> $dstfile\n";