2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
7 # Remove dir which contains whiteout from lower dir.
9 # The following kernel commit fixed the kernel crash on the removal
10 # 84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()
13 _begin_fstest auto quick whiteout
15 # Import common functions.
18 # real QA test starts here
20 # Use non-default scratch underlying overlay dirs, we need to check
21 # them explicity after test.
22 _require_scratch_nocheck
24 # Remove all files from previous tests
27 # Need two lower dirs in this test, and we mount overlay ourselves,
28 # create upper and workdir as well
29 lowerdir1=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.1
30 lowerdir2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
31 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
32 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
33 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
35 # One lowerdir contains test dir and test files, the other contains whiteout
36 mkdir -p $lowerdir1/testdir $lowerdir2/testdir
37 touch $lowerdir1/testdir/a $lowerdir1/testdir/b
38 mknod $lowerdir2/testdir/a c 0 0
40 # Mount overlayfs and remove testdir, which led to kernel crash
41 _overlay_scratch_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
42 rm -rf $SCRATCH_MNT/testdir
45 _overlay_check_scratch_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
48 echo "Silence is golden"