xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / btrfs / 089
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Omar Sandoval.  All Rights Reserved.
4 #
5 # FS QA Test 089
6 #
7 # Test deleting the default subvolume, making sure that submounts under it are
8 # not unmounted prematurely. This is a regression test for Linux commit "Btrfs:
9 # don't invalidate root dentry when subvolume deletion fails".
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/filter.btrfs
30
31 # real QA test starts here
32
33 # Modify as appropriate.
34 _supported_fs btrfs
35 _require_scratch
36
37 rm -f $seqres.full
38
39 _scratch_mkfs >>$seqres.full 2>&1
40 _scratch_mount
41
42 # Create a new subvolume and make it the default subvolume.
43 $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/testvol" >>$seqres.full 2>&1 \
44         || _fail "couldn't create subvol"
45 testvol_id=$(_btrfs_get_subvolid "$SCRATCH_MNT" testvol)
46 $BTRFS_UTIL_PROG subvolume set-default $testvol_id "$SCRATCH_MNT" >>$seqres.full 2>&1 \
47         || _fail "couldn't set default"
48
49 # Bind-mount a directory under the default subvolume.
50 mkdir "$SCRATCH_MNT/testvol/testdir"
51 mkdir "$SCRATCH_MNT/testvol/mnt"
52 mount --bind "$SCRATCH_MNT/testvol/testdir" "$SCRATCH_MNT/testvol/mnt"
53
54 # Now attempt to delete the default subvolume.
55 $BTRFS_UTIL_PROG subvolume delete "$SCRATCH_MNT/testvol" >>$seqres.full 2>&1
56
57 # Unmount the bind mount, which should still be alive.
58 $UMOUNT_PROG "$SCRATCH_MNT/testvol/mnt"
59
60 echo "Silence is golden"
61 status=0
62 exit