diff options
author | Andreas Dilger <adilger@whamcloud.com> | 2020-06-17 05:40:49 -0600 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-10-01 16:51:46 -0400 |
commit | a2292f8a5108b6b651008c34e272f7a149040557 (patch) | |
tree | 59273963e0d0ba4083787d96b89d22eea8b139eb /tests | |
parent | 4d13e6a57e42da92b2b4f6cf9dfeac445f8703f4 (diff) | |
download | e2fsprogs-a2292f8a5108b6b651008c34e272f7a149040557.tar.gz |
tune2fs: reset MMP state on error exit
If tune2fs cannot perform the requested change, ensure that the MMP
block is reset to the unused state before exiting. Otherwise, the
filesystem will be left with mmp_seq = EXT4_MMP_SEQ_FSCK set, which
prevents it from being mounted afterward:
EXT4-fs warning (device dm-9): ext4_multi_mount_protect:311:
fsck is running on the filesystem
Add a test to try some failed tune2fs operations and verify that the
MMP block is left in a clean state afterward.
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13672
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/t_mmp_2off/script | 4 | ||||
-rw-r--r-- | tests/t_mmp_fail/is_slow_test | 0 | ||||
-rw-r--r-- | tests/t_mmp_fail/name | 1 | ||||
-rw-r--r-- | tests/t_mmp_fail/script | 44 |
4 files changed, 47 insertions, 2 deletions
diff --git a/tests/t_mmp_2off/script b/tests/t_mmp_2off/script index ccd859b2..1cd07191 100644 --- a/tests/t_mmp_2off/script +++ b/tests/t_mmp_2off/script @@ -8,7 +8,7 @@ if [ "$status" != 0 ] ; then return $status fi -$TUNE2FS -O ^mmp $TMPFILE > $test_name.log 2>&1 +$TUNE2FS -O ^mmp $TMPFILE >> $test_name.log 2>&1 status=$? if [ "$status" != 0 ] ; then echo "tune2fs -O ^mmp failed" > $test_name.failed @@ -16,7 +16,7 @@ if [ "$status" != 0 ] ; then return $status fi -$FSCK $FSCK_OPT $TMPFILE > $test_name.log 2>&1 +$FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1 status=$? if [ "$status" = 0 ] ; then echo "$test_name: $test_description: ok" diff --git a/tests/t_mmp_fail/is_slow_test b/tests/t_mmp_fail/is_slow_test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/t_mmp_fail/is_slow_test diff --git a/tests/t_mmp_fail/name b/tests/t_mmp_fail/name new file mode 100644 index 00000000..e872ddaa --- /dev/null +++ b/tests/t_mmp_fail/name @@ -0,0 +1 @@ +error running tune2fs with MMP diff --git a/tests/t_mmp_fail/script b/tests/t_mmp_fail/script new file mode 100644 index 00000000..5fa6a846 --- /dev/null +++ b/tests/t_mmp_fail/script @@ -0,0 +1,44 @@ +FSCK_OPT=-yf + +$MKE2FS -q -F -o Linux -I 128 -b 1024 -O mmp $TMPFILE 100 > $test_name.log 2>&1 +status=$? +if [ "$status" != 0 ] ; then + echo "mke2fs -O mmp failed" > $test_name.failed + echo "$test_name: $test_description: failed" + return $status +fi + +$TUNE2FS -O project $TMPFILE >> $test_name.log 2>&1 +status=$? +if [ "$status" == 0 ] ; then + echo "'tune2fs -O project' succeeded on small inode" > $test_name.failed + echo "$test_name: $test_description: failed" + return 1 +fi +$TUNE2FS -o bad_option $TMPFILE >> $test_name.log 2>&1 +status=$? +if [ "$status" == 0 ] ; then + echo "'tune2fs -o bad_option' succeeded" > $test_name.failed + echo "$test_name: $test_description: failed" + return 1 +fi +$E2MMPSTATUS -i $TMPFILE >> $test_name.log 2>&1 +$E2MMPSTATUS $TMPFILE >> $test_name.log 2>&1 +status=$? +if [ "$status" != 0 ] ; then + echo "$TUNE2FS left MMP block in bad state" > $test_name.failed + echo "$test_name: $test_description: failed" + return $status +fi + +$FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1 +status=$? +if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "e2fsck after MMP disable failed" > $test_name.failed + echo "$test_name: $test_description: failed" + return $status +fi +rm -f $TMPFILE |