2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that if we create a hard link for a file F in some directory A, then move
8 # some directory or file B from its parent directory C into directory A, fsync
9 # file F, power fail and mount the filesystem, the directory/file B is located
10 # only at directory A and both links for file F exist.
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_dm_target flakey
39 _scratch_mkfs >>$seqres.full 2>&1
40 _require_metadata_journaling $SCRATCH_DEV
44 # Create our test directories and files.
47 touch $SCRATCH_MNT/x/foo
48 mkdir $SCRATCH_MNT/y/z
49 touch $SCRATCH_MNT/y/foo2
51 # Make sure everything is durably persisted.
54 # Now add a link to foo at directory x, move directory z and file foo2 from
55 # directory y to directory x and fsync foo's inode. We expect that after a
56 # log replay we see the new link for foo's inode and that z and foo2 are only
57 # located at directory x.
58 ln $SCRATCH_MNT/x/foo $SCRATCH_MNT/x/bar
59 mv $SCRATCH_MNT/y/z $SCRATCH_MNT/x/z
60 mv $SCRATCH_MNT/y/foo2 $SCRATCH_MNT/x/foo2
61 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/x/bar
62 _flakey_drop_and_remount
64 echo "Filesystem contents after log replay:"
65 ls -R $SCRATCH_MNT/x $SCRATCH_MNT/y | _filter_scratch