2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that if we have a very small file, with a size smaller than the block
8 # size, then fallocate a very small range within the block size but past the
9 # file's current size, fsync the file and then power fail, after mounting the
10 # filesystem all the file data is there and the file size is correct.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
31 # real QA test starts here
34 _require_xfs_io_command "falloc"
35 _require_dm_target flakey
39 _scratch_mkfs >>$seqres.full 2>&1
40 _require_metadata_journaling $SCRATCH_DEV
45 -c "pwrite -S 0xb6 0 21" \
48 $SCRATCH_MNT/foobar | _filter_xfs_io
50 # Simulate a power failure and mount the filesystem. We expect no data loss
51 # and a correct file size.
52 _flakey_drop_and_remount
54 echo "File content after power failure:"
55 od -t x1 -A d $SCRATCH_MNT/foobar