linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6.30 and later] file corruption on ext3 filesystem.
@ 2010-01-08  2:54 Tetsuo Handa
  2010-01-08  4:07 ` Jamie Lokier
  2010-01-08 12:36 ` Dave Chinner
  0 siblings, 2 replies; 8+ messages in thread
From: Tetsuo Handa @ 2010-01-08  2:54 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel

Hello.

I'm experiencing file corruption problem.
Can somebody reproduce below result?

My environment:
  VMware Workstation 6.5.3 with 2CPUs / 512MB RAM.
  ext3 filesystem ( /dev/sda1 ) mounted on / .

  2.6.33-rc3 ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.33-rc3-ext3 )
  2.6.32.3   ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.32.3-ext3 )
  2.6.31.11  ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.31.11-ext3 )
  2.6.30.10

  So far, I haven't succeeded to reproduce this problem for 2.6.29 and earlier.
  Maybe this problem exists in only 2.6.30 and later.

Steps to reproduce:

  Compile below program using "gcc -Wall -O3 -o a.out".

----------
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
	FILE *fp = fopen("/testfile", "a");
	char buffer[4096];
	memset(buffer, argc > 1 ? argv[1][0] : 0x20, sizeof(buffer));
	buffer[sizeof(buffer) - 1] = '\n';
	fwrite(buffer, 1, sizeof(buffer), fp);
	fflush(fp);
	sleep(5);
	fprintf(stderr, "Let power fail after a few seconds.\n");
	while (1) {
		sleep(1);
		fwrite(buffer, 1, sizeof(buffer), fp);
	}
	return 0;
}
----------

  Reboot the system by executing /sbin/reboot .

  Run ./a.out and let the power fail (i.e. unplug the electric cable
  or do equivalent) after more than 5 seconds (i.e. longer than kjournald's
  commit interval). Probably 2 or 3 seconds after
  "Let power fail after a few seconds.\n" was printed is the best.

  Restart the system (and fsck will be executed).

  Run "cat /testfile". It should contain only lines of 4095 spaces + '\n'
  (or the byte specified via argv[]). But it contains different data.

  This problem does not show up if the data written by ./a.out and the data in
  previously deleted files are identical. Therefore, you may want to try with
  different patterns like "./a.out 1" "./a.out 2" "./a.out 3" ...

Regards.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-15 20:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08  2:54 [2.6.30 and later] file corruption on ext3 filesystem Tetsuo Handa
2010-01-08  4:07 ` Jamie Lokier
2010-01-08 12:36 ` Dave Chinner
2010-01-08 13:15   ` Tetsuo Handa
2010-01-08 15:19     ` Dave Chinner
2010-01-09  2:53       ` Tetsuo Handa
2010-01-11 20:13         ` Ric Wheeler
2010-01-15 20:01           ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).