From: Menno Smits <menno@netbox.biz>
To: reiserfs-list@namesys.com
Subject: Repeatable corruption using Reiserfs 3
Date: Thu, 30 Oct 2003 16:04:09 +1000 [thread overview]
Message-ID: <3FA0A9D9.70705@netbox.biz> (raw)
Hi,
I've managed to cause repeatable file corruption using Reiserfs 3 and
have developed a simple test program to demonstrate.
Here's the background info:
Reiserfs version: v3.6.25 using the v3.6 filesystem (r5 hash)
Kernel version: have tested with Redhat 7.3 kernel 2.4.18-3 and vanilla
2.4.21 kernel.
Hardware: have tested repeatedly on 3 different i386 boxes of varying
specs and age.
Procedure:
- Compile the C program included below
- Change to a directory on a Reiserfs partition with a few 100MB of free
space
- Run the program. It will create three files "1", "2" and "3" which
each get filled with endless lines of repeated numbers corresponding
to the file name.
- When the program says to pull the power, rip the power cable out of
the back of the PC to simulate a power failure.
- Plug the power back in and wait for system to reboot.
- Change back to the directory where the test files where created.
- Examine the head of the files. You should get something like this:
$ head -5 [0-2]
==> 0 <==
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
==> 1 <==
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
==> 2 <==
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
- The result is expected and correct. Now look at the tail of the files.
The results vary on every run of the test but the contents of the
output files are always wrong. Two examples are:
$ tail -5 [0-2]
==> 0 <==
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
==> 1 <==
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
==> 2 <==
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
$ tail -5 [0-2]
==> 0 <==
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
==> 1 <==
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
==> 2 <==
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Clearly there is something rather bad happening here. I can understand
data not making it to disk but _not_ incorrect data being present.
I also have repeated these tests many times on the ext3 filesystem using
its ordered mode (default) on the same hardware. In this case the files
always contain the correct data (that is 0 contains only "0"s, 1
contains "1"s and 2 contains "2"s). I couldn't fault it once whereas the
tests on reiserfs always caused corrupt.
The reason I started doing this testing is because I was seeing major
corruption is various configuration files and Postgresql databases that
were being written to during a power failure. The configuration files
were being totally replaced with unrelated data from other parts of the
disk. I believe these tests show there is a genuine problem here.
I would appreciate any comments on this as well as feedback from anyone
else trying these tests.
Regards,
Menno Smits
Test program used to test reiser (dubbed "reiserkill").
I used "gcc -Wall -o reiserkill reiserkill.c" to compile.
----< SNIP >--------------------------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#define NUM_CHILDREN 3
#define ITEMS_PER_LINE 20
void child(int index)
{
FILE *f;
char outname[PATH_MAX];
char oneitem[10];
char *linebuf;
int i;
/* Prebuffer one line */
sprintf(oneitem, "%d ", index);
linebuf = malloc(ITEMS_PER_LINE * strlen(oneitem) + strlen("\n") + 1);
for (i=0; i<ITEMS_PER_LINE; i++)
strcat(linebuf, oneitem);
strcat(linebuf, "\n");
/* Open output file and dump output endlessly */
sprintf(outname, "%d", index);
f = fopen(outname, "w");
while (1) {
fputs(linebuf, f);
fflush(f);
}
}
int main()
{
int i;
for (i=0; i<NUM_CHILDREN; i++)
if (fork() == 0) child(i);
printf("Dumping data to disk. Please wait...\n");
sleep(15);
printf("Pull the power now!\n");
while (1) pause();
return 0;
}
----< SNIP >--------------------------------------------------------
next reply other threads:[~2003-10-30 6:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-30 6:04 Menno Smits [this message]
2003-10-30 11:57 ` Repeatable corruption using Reiserfs 3 Hans Reiser
2003-10-30 13:02 ` Christian Mayrhuber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FA0A9D9.70705@netbox.biz \
--to=menno@netbox.biz \
--cc=reiserfs-list@namesys.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.