3 [ -f "$TMPFILE" ] && rm -f $TMPFILE
7 stat -f $TMPFILE | grep -q "Type: tmpfs"
10 echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
14 echo "make the test image ..." > $test_name.log
15 $MKE2FS -q -F -o Linux -b 4096 -O mmp -E mmp_update_interval=1 $TMPFILE 100 >> $test_name.log 2>&1
17 if [ "$status" != 0 ] ; then
18 echo "mke2fs -O mmp failed" > $test_name.failed
19 echo "$test_name: $test_description: failed"
23 # this will cause debugfs to create the $test_name.mark file once it has
24 # passed the MMP startup, then continue reading input until it is killed
25 MARKFILE=$test_name.new
27 echo "set mmp sequence to EXT2_MMP_SEQ_FSCK..." >> $test_name.log
28 ( { echo dump_mmp; echo "dump_inode <2> $MARKFILE"; cat /dev/zero; } |
29 $DEBUGFS -w $TMPFILE >> $test_name.log 2>&1 & ) > /dev/null 2>&1 &
30 echo "wait until debugfs has started ..." >> $test_name.log
31 while [ ! -e $MARKFILE ]; do
35 echo "kill debugfs abruptly (simulates e2fsck failure) ..." >> $test_name.log
36 killall -9 debugfs >> $test_name.log
39 echo "e2fsck (should fail mmp_seq = EXT2_MMP_SEQ_FSCK) ..." >> $test_name.log
40 $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
42 if [ "$status" = 0 ] ; then
43 echo "e2fsck with MMP as EXT2_MMP_SEQ_FSCK ran!" > $test_name.failed
44 echo "$test_name: $test_description: failed"
48 echo "clear mmp_seq with tune2fs ..." >> $test_name.log
49 $TUNE2FS -f -E clear_mmp $TMPFILE >> $test_name.log 2>&1
51 if [ "$status" != 0 ] ; then
52 echo "tune2fs clearing EXT2_MMP_SEQ_FSCK failed" > $test_name.failed
53 echo "$test_name: $test_description: failed"
57 echo "run e2fsck again (should pass with clean mmp_seq) ..." >> $test_name.log
58 $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
60 if [ "$status" != 0 ] ; then
61 echo "e2fsck after clearing EXT2_MMP_SEQ_FSCK failed"> $test_name.failed
62 echo "$test_name: $test_description: failed"
66 echo "$test_name: $test_description: ok"