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
36 _require_dm_target flakey
40 _scratch_mkfs >>$seqres.full 2>&1
41 _require_metadata_journaling $SCRATCH_DEV
45 # Create our test directories and files.
48 touch $SCRATCH_MNT/x/foo
49 mkdir $SCRATCH_MNT/y/z
50 touch $SCRATCH_MNT/y/foo2
52 # Make sure everything is durably persisted.
55 # Now add a link to foo at directory x, move directory z and file foo2 from
56 # directory y to directory x and fsync foo's inode. We expect that after a
57 # log replay we see the new link for foo's inode and that z and foo2 are only
58 # located at directory x.
59 ln $SCRATCH_MNT/x/foo $SCRATCH_MNT/x/bar
60 mv $SCRATCH_MNT/y/z $SCRATCH_MNT/x/z
61 mv $SCRATCH_MNT/y/foo2 $SCRATCH_MNT/x/foo2
62 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/x/bar
63 _flakey_drop_and_remount
65 echo "Filesystem contents after log replay:"
66 ls -R $SCRATCH_MNT/x $SCRATCH_MNT/y | _filter_scratch