2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that if we delete a snapshot, delete its parent directory, create
8 # another directory with the same name as that parent and then fsync either
9 # the new directory or a file inside the new directory, the fsync succeeds,
10 # the fsync log is replayable and produces a correct result.
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
34 _require_dm_target flakey
40 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT \
41 $SCRATCH_MNT/testdir/snap
42 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/testdir/snap
43 rmdir $SCRATCH_MNT/testdir
44 mkdir $SCRATCH_MNT/testdir
47 _scratch_mkfs >>$seqres.full 2>&1
48 _require_metadata_journaling $SCRATCH_DEV
52 mkdir $SCRATCH_MNT/testdir
54 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir
55 _flakey_drop_and_remount
57 echo "Filesystem contents after the first log replay:"
58 ls -R $SCRATCH_MNT | _filter_scratch
60 # Now do the same as before but instead of doing an fsync against the directory,
61 # do an fsync against a file inside the directory.
64 touch $SCRATCH_MNT/testdir/foobar
65 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir/foobar
66 _flakey_drop_and_remount
68 echo "Filesystem contents after the second log replay:"
69 ls -R $SCRATCH_MNT | _filter_scratch