2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that if we fsync a tmpfile, without adding a hard link to it, and then
8 # power fail, we will be able to mount the filesystem without triggering any
9 # crashes, warnings or corruptions.
12 _begin_fstest auto quick log
14 # Override the default cleanup function.
22 # Import common functions.
26 # real QA test starts here
29 _require_xfs_io_command "-T"
30 _require_dm_target flakey
32 _scratch_mkfs >>$seqres.full 2>&1
33 _require_metadata_journaling $SCRATCH_DEV
37 # Create our tmpfile, write some data to it and fsync it. We want a power
38 # failure to happen after the fsync, so that we have an inode with a link
39 # count of 0 in our log/journal.
41 -c "pwrite -S 0xab 0 64K" \
43 $SCRATCH_MNT | _filter_xfs_io
45 # Simulate a power failure and mount the filesystem to check that it succeeds.
46 _flakey_drop_and_remount