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
35 _require_xfs_io_command "falloc"
36 _require_dm_target flakey
40 _scratch_mkfs >>$seqres.full 2>&1
41 _require_metadata_journaling $SCRATCH_DEV
46 -c "pwrite -S 0xb6 0 21" \
49 $SCRATCH_MNT/foobar | _filter_xfs_io
51 # Simulate a power failure and mount the filesystem. We expect no data loss
52 # and a correct file size.
53 _flakey_drop_and_remount
55 echo "File content after power failure:"
56 od -t x1 -A d $SCRATCH_MNT/foobar