2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
7 # There are dirs/files in lower dir and upper dir before
8 # mounting overlayfs. After mounting, use dir in overlayfs
9 # mountpoint as lowerdir to mount another overlayfs, then
10 # access old files through the second overlayfs. It was
11 # not working, kernel commit below fixed it.
13 # c4fcfc1619ea ovl: fix d_real() for stacked fs
15 # This reproducer was originally written by
16 # Miklos Szeredi <mszeredi@redhat.com>
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
24 status=1 # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
39 # remove previous $seqres.full before test
42 # real QA test starts here
44 # Modify as appropriate.
48 # Remove all files from previous tests
52 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
53 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
55 echo foo > $upperdir/up/foo
56 mkdir -p $lowerdir/low
57 echo bar > $lowerdir/low/bar
59 # mount overlay in SCRATCH_MNT
62 mkdir -p $tmp/{upper,mnt,work}
63 # mount overlay again using upper dir from SCRATCH_MNT dir
64 _overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
66 # accessing file in the second mount
70 # re-create upper/work to avoid ovl_verify_origin() mount failure
71 # when index is enabled
72 rm -rf $tmp/{upper,work}
73 mkdir -p $tmp/{upper,work}
74 # mount overlay again using lower dir from SCRATCH_MNT dir
75 _overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
80 rm -rf $tmp/{upper,work}
81 mkdir -p $tmp/{upper,work}
82 # mount overlay again using SCRATCH_MNT dir
83 _overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \