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
35 _require_dm_target flakey
41 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT \
42 $SCRATCH_MNT/testdir/snap
43 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/testdir/snap
44 rmdir $SCRATCH_MNT/testdir
45 mkdir $SCRATCH_MNT/testdir
48 _scratch_mkfs >>$seqres.full 2>&1
49 _require_metadata_journaling $SCRATCH_DEV
53 mkdir $SCRATCH_MNT/testdir
55 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir
56 _flakey_drop_and_remount
58 echo "Filesystem contents after the first log replay:"
59 ls -R $SCRATCH_MNT | _filter_scratch
61 # Now do the same as before but instead of doing an fsync against the directory,
62 # do an fsync against a file inside the directory.
65 touch $SCRATCH_MNT/testdir/foobar
66 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir/foobar
67 _flakey_drop_and_remount
69 echo "Filesystem contents after the second log replay:"
70 ls -R $SCRATCH_MNT | _filter_scratch