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
36 _require_dm_target flakey
40 fssum_files_dir=$TEST_DIR/generic-test-$seq
41 rm -fr $fssum_files_dir
42 mkdir $fssum_files_dir
44 _scratch_mkfs >>$seqres.full 2>&1
45 _require_metadata_journaling $SCRATCH_DEV
49 mkdir $SCRATCH_MNT/test
50 args=`_scale_fsstress_args -p 4 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/test`
51 args="$args -f mknod=0 -f symlink=0"
52 echo "Running fsstress with arguments: $args" >>$seqres.full
53 $FSSTRESS_PROG $args >>$seqres.full
55 # Fsync every file and directory.
56 find $SCRATCH_MNT/test \( -type f -o -type d \) -exec $XFS_IO_PROG -c fsync {} \;
58 # Compute a digest of the filesystem (using the test directory only, to skip
59 # fs specific directories such as "lost+found" on ext4 for example).
60 $FSSUM_PROG -A -f -w $fssum_files_dir/fs_digest $SCRATCH_MNT/test
62 # Simulate a power failure and mount the filesystem to check that all files and
63 # directories exist and have all data and metadata preserved.
64 _flakey_drop_and_remount
66 # Compute a new digest and compare it to the one we created previously, they
68 $FSSUM_PROG -r $fssum_files_dir/fs_digest $SCRATCH_MNT/test