xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 118
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FSQA Test No. 118
6 #
7 # Test that if we fsync a directory that had a snapshot entry in it that was
8 # deleted and crash, the next time we mount the filesystem, the log replay
9 # procedure will not fail and the snapshot is not present anymore.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         _cleanup_flakey
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/dmflakey
29
30 # real QA test starts here
31 _supported_fs btrfs
32 _supported_os Linux
33 _require_scratch
34 _require_dm_target flakey
35
36 rm -f $seqres.full
37
38 _scratch_mkfs >>$seqres.full 2>&1
39 _require_metadata_journaling $SCRATCH_DEV
40 _init_flakey
41 _mount_flakey
42
43 # Create a snapshot at the root of our filesystem (mount point path), delete it,
44 # fsync the mount point path, crash and mount to replay the log. This should
45 # succeed and after the filesystem is mounted the snapshot should not be visible
46 # anymore.
47 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap1
48 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/snap1
49 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT
50 _flakey_drop_and_remount
51 [ -e $SCRATCH_MNT/snap1 ] && echo "Snapshot snap1 still exists after log replay"
52
53 # Similar scenario as above, but this time the snapshot is created inside a
54 # directory and not directly under the root (mount point path).
55 mkdir $SCRATCH_MNT/testdir
56 _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/testdir/snap2
57 _run_btrfs_util_prog subvolume delete $SCRATCH_MNT/testdir/snap2
58 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir
59 _flakey_drop_and_remount
60 [ -e $SCRATCH_MNT/testdir/snap2 ] && \
61         echo "Snapshot snap2 still exists after log replay"
62
63 _unmount_flakey
64
65 echo "Silence is golden"
66
67 status=0
68 exit