4 # Test creating a symlink, fsync its parent directory, power fail and mount
5 # again the filesystem. After these steps the symlink should exist and its
6 # content must match what we specified when we created it (must not be empty
7 # or point to something else).
9 #-----------------------------------------------------------------------
11 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
12 # Author: Filipe Manana <fdmanana@suse.com>
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #-----------------------------------------------------------------------
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
48 # real QA test starts here
52 _require_dm_target flakey
56 _scratch_mkfs >>$seqres.full 2>&1
57 _require_metadata_journaling $SCRATCH_DEV
61 mkdir $SCRATCH_MNT/testdir1
62 # Make sure it's durably persisted.
65 # Create our symlinks and fsync their parent directories.
66 # We test both the case where the parent directory is new (not yet durably
67 # persisted) and where the parent existed long time before.
68 ln -s $SCRATCH_MNT/foo1 $SCRATCH_MNT/testdir1/bar1
69 $XFS_IO_PROG -c fsync $SCRATCH_MNT/testdir1
70 mkdir $SCRATCH_MNT/testdir2
71 ln -s $SCRATCH_MNT/foo2 $SCRATCH_MNT/testdir2/bar2
72 $XFS_IO_PROG -c fsync $SCRATCH_MNT/testdir2
74 # After a power failure and mounting again the filesystem, we expect to see the
75 # symlinks and we expect them to point to foo1 and foo2.
76 _flakey_drop_and_remount
78 echo "Symlink contents after log replay:"
79 readlink $SCRATCH_MNT/testdir1/bar1 | _filter_scratch
80 readlink $SCRATCH_MNT/testdir2/bar2 | _filter_scratch