summaryrefslogtreecommitdiff
path: root/tests/overlay/022
blob: 09af6500ca2a7d61a0f72eba6457fc1eaf059d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
#
# FS QA Test 022
#
# Regression test for kernel commit:
#     76bc8e2 ovl: disallow overlayfs as upperdir
#
# This reproducer was originally written by
#     Miklos Szeredi <mszeredi@redhat.com>
#
. ./common/preamble
_begin_fstest auto quick mount nested

# Override the default cleanup function.
_cleanup()
{
	cd /
	$UMOUNT_PROG $tmp/mnt > /dev/null 2>&1
	rm -rf $tmp
	rm -f $tmp.*
}

# Import common functions.
. ./common/filter

# real QA test starts here

# Modify as appropriate.
_supported_fs overlay
_fixed_by_kernel_commit 76bc8e2843b6 "ovl: disallow overlayfs as upperdir"

_require_scratch

# Remove all files from previous tests
_scratch_mkfs

upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
mkdir -p $upperdir/upper
mkdir -p $upperdir/work
# mount overlay with dirs in upper
_scratch_mount

mkdir -p $tmp/{lower,mnt}
# mount overlay using upper from another overlay upper
# should fail
_overlay_mount_dirs $tmp/lower $SCRATCH_MNT/upper \
  $SCRATCH_MNT/work overlay $tmp/mnt > /dev/null 2>&1
if [ $? -ne 0 ] ; then
	echo "Silence is golden"
else
	echo "Test Fail"
	echo "Overlay upperdir can't be another overlay upperdir"
fi

# success, all done
status=0
exit