2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that if we create a new hard link for a file which was previously
8 # fsync'ed, fsync a parent directory of the new hard link and power fail,
9 # the parent directory exists after mounting the filesystem again.
12 _begin_fstest auto quick log
14 # Override the default cleanup function.
22 # Import common functions.
26 # real QA test starts here
30 _require_dm_target flakey
32 _scratch_mkfs >>$seqres.full 2>&1
33 _require_metadata_journaling $SCRATCH_DEV
39 mkdir $SCRATCH_MNT/A/C
40 touch $SCRATCH_MNT/B/foo
41 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/B/foo
42 # It is important the new hard link is located in a hierarchy of new directories
43 # (not yet persisted).
44 ln $SCRATCH_MNT/B/foo $SCRATCH_MNT/A/C/foo
45 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/A
47 # Simulate a power failure and mount the filesystem to check that what we
48 # explicitly fsync'ed exists.
49 _flakey_drop_and_remount
51 [ -d $SCRATCH_MNT/A ] || echo "directory A missing"
52 [ -f $SCRATCH_MNT/B/foo ] || echo "file B/foo is missing"
56 echo "Silence is golden"