4 # Remove dir which contains whiteout from lower dir.
6 # The following kernel commit fixed the kernel crash on the removal
7 # 84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
42 # get standard environment, filters and checks
48 # real QA test starts here
53 # Remove all files from previous tests
56 # Need two lower dirs in this test, and we mount overlay ourselves,
57 # create upper and workdir as well
58 lowerdir1=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.1
59 lowerdir2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
60 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
61 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
62 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
64 # One lowerdir contains test dir and test files, the other contains whiteout
65 mkdir -p $lowerdir1/testdir $lowerdir2/testdir
66 touch $lowerdir1/testdir/a $lowerdir1/testdir/b
67 mknod $lowerdir2/testdir/a c 0 0
69 # Mount overlayfs and remove testdir, which led to kernel crash
70 _overlay_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir \
71 $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
72 rm -rf $SCRATCH_MNT/testdir
75 echo "Silence is golden"