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 _begin_fstest auto quick snapshot metadata log
15 # Override the default cleanup function.
23 # Import common functions.
27 # real QA test starts here
30 _require_dm_target flakey
34 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT \
35 $SCRATCH_MNT/testdir/snap
36 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/testdir/snap
37 rmdir $SCRATCH_MNT/testdir
38 mkdir $SCRATCH_MNT/testdir
41 _scratch_mkfs >>$seqres.full 2>&1
42 _require_metadata_journaling $SCRATCH_DEV
46 mkdir $SCRATCH_MNT/testdir
48 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir
49 _flakey_drop_and_remount
51 echo "Filesystem contents after the first log replay:"
52 ls -R $SCRATCH_MNT | _filter_scratch
54 # Now do the same as before but instead of doing an fsync against the directory,
55 # do an fsync against a file inside the directory.
58 touch $SCRATCH_MNT/testdir/foobar
59 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir/foobar
60 _flakey_drop_and_remount
62 echo "Filesystem contents after the second log replay:"
63 ls -R $SCRATCH_MNT | _filter_scratch