blob: 9e21763aaeec0c806eefb0e9340815d3c387b8e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
#
# FSQA Test No. 343
#
# Test that if we create a hard link for a file F in some directory A, then move
# some directory or file B from its parent directory C into directory A, fsync
# file F, power fail and mount the filesystem, the directory/file B is located
# only at directory A and both links for file F exist.
#
. ./common/preamble
_begin_fstest auto quick metadata log
# Override the default cleanup function.
_cleanup()
{
_cleanup_flakey
cd /
rm -f $tmp.*
}
# Import common functions.
. ./common/filter
. ./common/dmflakey
# real QA test starts here
_supported_fs generic
_require_scratch
_require_hardlinks
_require_dm_target flakey
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
_mount_flakey
# Create our test directories and files.
mkdir $SCRATCH_MNT/x
mkdir $SCRATCH_MNT/y
touch $SCRATCH_MNT/x/foo
mkdir $SCRATCH_MNT/y/z
touch $SCRATCH_MNT/y/foo2
# Make sure everything is durably persisted.
sync
# Now add a link to foo at directory x, move directory z and file foo2 from
# directory y to directory x and fsync foo's inode. We expect that after a
# log replay we see the new link for foo's inode and that z and foo2 are only
# located at directory x.
ln $SCRATCH_MNT/x/foo $SCRATCH_MNT/x/bar
mv $SCRATCH_MNT/y/z $SCRATCH_MNT/x/z
mv $SCRATCH_MNT/y/foo2 $SCRATCH_MNT/x/foo2
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/x/bar
_flakey_drop_and_remount
echo "Filesystem contents after log replay:"
ls -R $SCRATCH_MNT/x $SCRATCH_MNT/y | _filter_scratch
_unmount_flakey
status=0
exit
|