2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
7 # Run fsstress, fsync every file and directory, simulate a power failure and
8 # then verify that all files and directories exist, with the same data and
9 # metadata they had before the power failure.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
30 # real QA test starts here
35 _require_dm_target flakey
39 fssum_files_dir=$TEST_DIR/generic-test-$seq
40 rm -fr $fssum_files_dir
41 mkdir $fssum_files_dir
43 _scratch_mkfs >>$seqres.full 2>&1
44 _require_metadata_journaling $SCRATCH_DEV
48 mkdir $SCRATCH_MNT/test
49 args=`_scale_fsstress_args -p 4 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/test`
50 args="$args -f mknod=0 -f symlink=0"
51 echo "Running fsstress with arguments: $args" >>$seqres.full
52 $FSSTRESS_PROG $args >>$seqres.full
54 # Fsync every file and directory.
55 find $SCRATCH_MNT/test \( -type f -o -type d \) -exec $XFS_IO_PROG -c fsync {} \;
57 # Compute a digest of the filesystem (using the test directory only, to skip
58 # fs specific directories such as "lost+found" on ext4 for example).
59 $FSSUM_PROG -A -f -w $fssum_files_dir/fs_digest $SCRATCH_MNT/test
61 # Simulate a power failure and mount the filesystem to check that all files and
62 # directories exist and have all data and metadata preserved.
63 _flakey_drop_and_remount
65 # Compute a new digest and compare it to the one we created previously, they
67 $FSSUM_PROG -r $fssum_files_dir/fs_digest $SCRATCH_MNT/test