4 # Test that if we delete a snapshot, delete its parent directory, create
5 # another directory with the same name as that parent and then fsync either
6 # the new directory or a file inside the new directory, the fsync succeeds,
7 # the fsync log is replayable and produces a correct result.
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
53 _require_metadata_journaling $SCRATCH_DEV
59 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT \
60 $SCRATCH_MNT/testdir/snap
61 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/testdir/snap
62 rmdir $SCRATCH_MNT/testdir
63 mkdir $SCRATCH_MNT/testdir
66 _scratch_mkfs >>$seqres.full 2>&1
70 mkdir $SCRATCH_MNT/testdir
72 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir
73 _flakey_drop_and_remount
75 echo "Filesystem contents after the first log replay:"
76 ls -R $SCRATCH_MNT | _filter_scratch
78 # Now do the same as before but instead of doing an fsync against the directory,
79 # do an fsync against a file inside the directory.
82 touch $SCRATCH_MNT/testdir/foobar
83 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir/foobar
84 _flakey_drop_and_remount
86 echo "Filesystem contents after the second log replay:"
87 ls -R $SCRATCH_MNT | _filter_scratch