master - tests: fsadm test continue after fs repair
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=be94410446d381ab0512d347421a921c7966a10e Commit: be94410446d381ab0512d347421a921c7966a10e Parent: 8c2779ba349e5ced3c9ea440929a6808ca443bf4 Author: Zdenek Kabelac <[email protected]> AuthorDate: Sat Oct 24 00:29:45 2020 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Sat Oct 24 01:42:16 2020 +0200
tests: fsadm test continue after fs repair
Test case where filesystem has been corrected via fsck. In such case fsck returns '1' as success and should be handled in a same way as '0' since fs is correct.
--- test/shell/fsadm.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
test/shell/fsadm.sh +26 -1
@@ -61,7 +61,8 @@ cleanup_mounted_and_teardown() fscheck_ext3() { - fsck.ext3 -p -F -f "$dev_vg_lv" + # fsck with result code '1' is success + fsck.ext3 -p -F -f "$dev_vg_lv" || test "$?" -eq 1 } fscheck_xfs()
@@ -113,6 +114,30 @@ if check_missing ext2; then fscheck_ext3 lvresize -f -L20M $vg_lv + + if which debugfs ; then + mkfs.ext2 -b4096 -j "$dev_vg_lv" + mount "$dev_vg_lv" "$mount_dir" + touch "$mount_dir/file" + umount "$mount_dir" + # generate a 'repariable' corruption + # so fsck returns code 1 (fs repaired) + debugfs -R "clri file" -w "$dev_vg_lv" + + fsadm -v -f check "$dev_vg_lv" + + # corrupting again + mount "$dev_vg_lv" "$mount_dir" + touch "$mount_dir/file" + umount "$mount_dir" + debugfs -R "clri file" -w "$dev_vg_lv" + + mount "$dev_vg_lv" "$mount_dir" + fsadm -v -y --lvresize resize $vg_lv 10M + lvresize -L+10M -y -r -n $vg_lv + umount "$mount_dir" 2>/dev/null || true + fscheck_ext3 + fi fi if check_missing ext3; then