tests: test writing and recovering checksum-free 32/64bit journals

Simple tests for the journal transaction creation code.   We test
writing (bad) block bitmaps out through the journal and replaying them
via fsck, with a few twists:

(a) All bitmaps are committed (fs errors reported)
(b) All the bitmap blocks are revoked (no errors)
(c) The transaction is never committed (no errors)
(d) Same as (a), but debugfs gets to do the replay.

We also test:

(a) writing and replaying transactions with multiple
    descriptor blocks
(b) same, but with multiple revoke blocks.
(c) adding the 64bit flag to a journal

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2014-09-08 16:13:01 -07:00 committed by Theodore Ts'o
parent 463eb92131
commit 9ce517d43e
25 changed files with 927 additions and 0 deletions

1
tests/defaults/j_script Normal file
View File

@ -0,0 +1 @@
. $cmd_dir/run_e2fsck

View File

@ -0,0 +1,81 @@
Creating filesystem with 262144 1k blocks and 16384 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 14431/262144 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 1 (descriptor block) at block 126
Found expected sequence 1, type 1 (descriptor block) at block 251
Found expected sequence 1, type 1 (descriptor block) at block 376
Found expected sequence 1, type 1 (descriptor block) at block 501
Found expected sequence 1, type 1 (descriptor block) at block 626
Found expected sequence 1, type 1 (descriptor block) at block 751
Found expected sequence 1, type 1 (descriptor block) at block 876
Found expected sequence 1, type 1 (descriptor block) at block 1001
Found expected sequence 1, type 1 (descriptor block) at block 1126
Found expected sequence 1, type 1 (descriptor block) at block 1251
Found expected sequence 1, type 1 (descriptor block) at block 1376
Found expected sequence 1, type 1 (descriptor block) at block 1501
Found expected sequence 1, type 1 (descriptor block) at block 1626
Found expected sequence 1, type 1 (descriptor block) at block 1751
Found expected sequence 1, type 1 (descriptor block) at block 1876
Found expected sequence 1, type 1 (descriptor block) at block 2001
Found expected sequence 1, type 1 (descriptor block) at block 2126
Found expected sequence 1, type 1 (descriptor block) at block 2251
Found expected sequence 1, type 1 (descriptor block) at block 2376
Found expected sequence 1, type 1 (descriptor block) at block 2501
Found expected sequence 1, type 1 (descriptor block) at block 2626
Found expected sequence 1, type 1 (descriptor block) at block 2751
Found expected sequence 1, type 1 (descriptor block) at block 2876
Found expected sequence 1, type 1 (descriptor block) at block 3001
Found expected sequence 1, type 1 (descriptor block) at block 3126
Found expected sequence 1, type 1 (descriptor block) at block 3251
Found expected sequence 1, type 1 (descriptor block) at block 3376
Found expected sequence 1, type 1 (descriptor block) at block 3501
Found expected sequence 1, type 1 (descriptor block) at block 3626
Found expected sequence 1, type 1 (descriptor block) at block 3751
Found expected sequence 1, type 1 (descriptor block) at block 3876
Found expected sequence 1, type 1 (descriptor block) at block 4001
Found expected sequence 1, type 1 (descriptor block) at block 4126
Found expected sequence 1, type 2 (commit block) at block 4133
Found expected sequence 2, type 5 (revoke table) at block 4134
Found expected sequence 2, type 5 (revoke table) at block 4135
Found expected sequence 2, type 5 (revoke table) at block 4136
Found expected sequence 2, type 5 (revoke table) at block 4137
Found expected sequence 2, type 5 (revoke table) at block 4138
Found expected sequence 2, type 5 (revoke table) at block 4139
Found expected sequence 2, type 5 (revoke table) at block 4140
Found expected sequence 2, type 5 (revoke table) at block 4141
Found expected sequence 2, type 5 (revoke table) at block 4142
Found expected sequence 2, type 5 (revoke table) at block 4143
Found expected sequence 2, type 5 (revoke table) at block 4144
Found expected sequence 2, type 5 (revoke table) at block 4145
Found expected sequence 2, type 5 (revoke table) at block 4146
Found expected sequence 2, type 5 (revoke table) at block 4147
Found expected sequence 2, type 5 (revoke table) at block 4148
Found expected sequence 2, type 5 (revoke table) at block 4149
Found expected sequence 2, type 5 (revoke table) at block 4150
Found expected sequence 2, type 2 (commit block) at block 4151
No magic number at block 4152: end of journal.
test_filesys: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 14431/262144 blocks
Exit status is 0

View File

@ -0,0 +1 @@
revoked transaction nuking free space

View File

@ -0,0 +1,62 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 1024 -O has_journal -T ext4 $TMPFILE 262144 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
echo "jo" >> $TMPFILE.cmd
echo "jw -r 259-4356" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

107
tests/j_long_trans/expect Normal file
View File

@ -0,0 +1,107 @@
Creating filesystem with 262144 1k blocks and 16384 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 14431/262144 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 1 (descriptor block) at block 126
Found expected sequence 1, type 1 (descriptor block) at block 251
Found expected sequence 1, type 1 (descriptor block) at block 376
Found expected sequence 1, type 1 (descriptor block) at block 501
Found expected sequence 1, type 1 (descriptor block) at block 626
Found expected sequence 1, type 1 (descriptor block) at block 751
Found expected sequence 1, type 1 (descriptor block) at block 876
Found expected sequence 1, type 1 (descriptor block) at block 1001
Found expected sequence 1, type 1 (descriptor block) at block 1126
Found expected sequence 1, type 1 (descriptor block) at block 1251
Found expected sequence 1, type 1 (descriptor block) at block 1376
Found expected sequence 1, type 1 (descriptor block) at block 1501
Found expected sequence 1, type 1 (descriptor block) at block 1626
Found expected sequence 1, type 1 (descriptor block) at block 1751
Found expected sequence 1, type 1 (descriptor block) at block 1876
Found expected sequence 1, type 1 (descriptor block) at block 2001
Found expected sequence 1, type 1 (descriptor block) at block 2126
Found expected sequence 1, type 1 (descriptor block) at block 2251
Found expected sequence 1, type 1 (descriptor block) at block 2376
Found expected sequence 1, type 1 (descriptor block) at block 2501
Found expected sequence 1, type 1 (descriptor block) at block 2626
Found expected sequence 1, type 1 (descriptor block) at block 2751
Found expected sequence 1, type 1 (descriptor block) at block 2876
Found expected sequence 1, type 1 (descriptor block) at block 3001
Found expected sequence 1, type 1 (descriptor block) at block 3126
Found expected sequence 1, type 1 (descriptor block) at block 3251
Found expected sequence 1, type 1 (descriptor block) at block 3376
Found expected sequence 1, type 1 (descriptor block) at block 3501
Found expected sequence 1, type 1 (descriptor block) at block 3626
Found expected sequence 1, type 1 (descriptor block) at block 3751
Found expected sequence 1, type 1 (descriptor block) at block 3876
Found expected sequence 1, type 1 (descriptor block) at block 4001
Found expected sequence 1, type 1 (descriptor block) at block 4126
Found expected sequence 1, type 2 (commit block) at block 4133
No magic number at block 4134: end of journal.
test_filesys: recovering journal
Superblock has an invalid journal (inode 8).
Clear? yes
*** ext3 journal has been deleted - filesystem is now ext2 only ***
Resize inode not valid. Recreate? yes
Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory. Clear? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate? yes
/lost+found not found. Create? yes
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(1--259) +273 +275 +289 +(291--418) +(2083--2210) +2341
Fix? yes
Free blocks count wrong for group #0 (5838, counted=5851).
Fix? yes
Free blocks count wrong for group #14 (0, counted=8192).
Fix? yes
Free blocks count wrong (247711, counted=255916).
Fix? yes
Inode bitmap differences: +1 +(3--10)
Fix? yes
Free inodes count wrong for group #0 (500, counted=501).
Fix? yes
Directories count wrong for group #0 (3, counted=2).
Fix? yes
Free inodes count wrong (16372, counted=16373).
Fix? yes
Recreate journal? yes
Creating journal (8192 blocks): Done.
*** journal has been re-created - filesystem is now ext3 again ***
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16384 files (0.0% non-contiguous), 14420/262144 blocks
Exit status is 1

1
tests/j_long_trans/name Normal file
View File

@ -0,0 +1 @@
transaction nuking free space

59
tests/j_long_trans/script Normal file
View File

@ -0,0 +1,59 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 1024 -O has_journal -T ext4 $TMPFILE 262144 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,32 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 2 (commit block) at block 6
Found expected sequence 2, type 5 (revoke table) at block 7
Found expected sequence 2, type 2 (commit block) at block 8
No magic number at block 9: end of journal.
test_filesys: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0

View File

@ -0,0 +1 @@
revoke blocks of transaction nuking bitmaps

View File

@ -0,0 +1,64 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
echo "jo" >> $TMPFILE.cmd
echo "jw -r $bitmaps" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,38 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 2 (commit block) at block 6
No magic number at block 7: end of journal.
test_filesys: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(0--1050) +(32768--36880)
Fix? yes
Inode bitmap differences: +(1--11)
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 1

1
tests/j_short_trans/name Normal file
View File

@ -0,0 +1 @@
transaction nuking the bitmaps

View File

@ -0,0 +1,61 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,40 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5196/65536 blocks
Exit status is 0
Journal features: (none)
debugfs write journal
Journal features: journal_64bit
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 2 (commit block) at block 6
No magic number at block 7: end of journal.
test_filesys: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(0--1066) +(32768--36896)
Fix? yes
Inode bitmap differences: +(1--11)
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16384 files (0.0% non-contiguous), 5196/65536 blocks
Exit status is 1

View File

@ -0,0 +1 @@
transaction nuking the bitmaps on 64bit

View File

@ -0,0 +1,65 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,43 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 2 (commit block) at block 6
No magic number at block 7: end of journal.
debugfs can't recover open journal
debugfs: jo
debugfs: jr
Please close the journal before recovering it.
debugfs: jc
test_filesys: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(0--1050) +(32768--36880)
Fix? yes
Inode bitmap differences: +(1--11)
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 1

View File

@ -0,0 +1 @@
ensure we can't recover the journal with journal open

View File

@ -0,0 +1,69 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
echo "debugfs can't recover open journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jr" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd > $OUT.new 2>&1
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,40 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 1, transaction 1
Found expected sequence 1, type 1 (descriptor block) at block 1
Found expected sequence 1, type 2 (commit block) at block 7
Found expected sequence 2, type 5 (revoke table) at block 8
Found expected sequence 2, type 2 (commit block) at block 9
No magic number at block 10: end of journal.
debugfs recover journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(0--1050) +(32768--36880)
Fix? yes
Inode bitmap differences: +(1--11)
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 1

View File

@ -0,0 +1 @@
transaction nuking the bitmaps (debugfs recovery)

View File

@ -0,0 +1,70 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b 333,$bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
echo "jo" >> $TMPFILE.cmd
echo "jw -r 333" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
echo "debugfs recover journal" >> $OUT
echo "jr" > $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,26 @@
Creating filesystem with 65536 4k blocks and 16384 inodes
Superblock backups stored on blocks:
32768
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0
debugfs write journal
debugfs: logdump -c
Journal starts at block 0, transaction 1
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Exit status is 0

View File

@ -0,0 +1 @@
uncommitted transaction nuking bitmaps

View File

@ -0,0 +1,61 @@
if test -x $DEBUGFS_EXE; then
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*Block bitmap at \([0-9]*\) .*Inode bitmap at \([0-9]*\).*$/\1,\2/g' | tr '\n' ',')"
echo "debugfs write journal" >> $OUT
echo "jo" > $TMPFILE.cmd
echo "jw -b $bitmaps -c /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd 2>> $OUT.new > /dev/null
sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
rm -rf $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
$DEBUGFS_EXE $TMPFILE -f $TMPFILE.cmd 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
rm -rf $TMPFILE.cmd
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
rm -f $OUT.new
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP
else #if test -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi