Whamcloud - gitweb
tests: create random filesystem, corrupt, e2fsck
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 13 Apr 2012 07:53:39 +0000 (01:53 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 29 May 2012 08:09:26 +0000 (02:09 -0600)
commitebd512a48415d5ef8cea2c47fe1771b9da01e66e
tree6d157e2dc9441760e218282d0bcfb3a8743b8d81
parent0a22bdace71ff4fe1e4058e9bb80d74cad225f01
tests: create random filesystem, corrupt, e2fsck

The f_random_corruption test enables a random subset of filesystem
features, picks one of the valid filesystem block and inode sizes,
and a random device size and creates a new filesystem with those
parameters.

It is possible to disable the running of the test by setting the
environment variable F_RANDOM_CORRUPTION=skip.  By default the test
script is run only one time, but setting the LOOP_COUNT variable
allows the test to run multiple times.

If the script is running as root the filesystem is mounted and
populated with file data to allow a more useful test filesystem
to be generated.  In some cases the kernel may not support the
requested filesystem features and the filesystem cannot be mounted.
This is not considered a test failure.

The resulting filesystem is corrupted with both random data and
by shifting data from one part of the device to another and then
repaired by e2fsck.  In some rare cases the random corruption is
severe enough that the filesystem is not recoverable (e.g. small
filesystem with no backup superblock has bad superblock corruption)
but in most cases "e2fsck -fy" should be able to fix all errors
in some way.

After e2fsck has repaired the filesystem, it is optionally mounted
(if the environment variable MOUNT_AFTER_CORRUPTION=yes is set) and
the test files created in the filesystem are deleted.  This verifies
that the fixes in the filesystem are sufficient for the kernel to
use the filesystem without error.  Since there is some possibility
of the kernel oopsing if there is a filesystem bug, this part of
the test is not enabled by default.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
tests/f_random_corruption/name [new file with mode: 0644]
tests/f_random_corruption/script [new file with mode: 0644]