xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / overlay / 010
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 010
6 #
7 # Remove dir which contains whiteout from lower dir.
8 #
9 # The following kernel commit fixed the kernel crash on the removal
10 # 84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 rm -f $seqres.full
32
33 # real QA test starts here
34 _supported_fs overlay
35 # Use non-default scratch underlying overlay dirs, we need to check
36 # them explicity after test.
37 _require_scratch_nocheck
38
39 # Remove all files from previous tests
40 _scratch_mkfs
41
42 # Need two lower dirs in this test, and we mount overlay ourselves,
43 # create upper and workdir as well
44 lowerdir1=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.1
45 lowerdir2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
46 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
47 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
48 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
49
50 # One lowerdir contains test dir and test files, the other contains whiteout
51 mkdir -p $lowerdir1/testdir $lowerdir2/testdir
52 touch $lowerdir1/testdir/a $lowerdir1/testdir/b
53 mknod $lowerdir2/testdir/a c 0 0
54
55 # Mount overlayfs and remove testdir, which led to kernel crash
56 _overlay_scratch_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
57 rm -rf $SCRATCH_MNT/testdir
58
59 # check overlayfs
60 _overlay_check_scratch_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
61
62 # success, all done
63 echo "Silence is golden"
64 status=0
65 exit