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.
49 # Remove all files from previous tests
53 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
54 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
56 echo foo > $upperdir/up/foo
57 mkdir -p $lowerdir/low
58 echo bar > $lowerdir/low/bar
60 # mount overlay in SCRATCH_MNT
63 mkdir -p $tmp/{upper,mnt,work}
64 # mount overlay again using upper dir from SCRATCH_MNT dir
65 _overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
67 # accessing file in the second mount
71 # re-create upper/work to avoid ovl_verify_origin() mount failure
72 # when index is enabled
73 rm -rf $tmp/{upper,work}
74 mkdir -p $tmp/{upper,work}
75 # mount overlay again using lower dir from SCRATCH_MNT dir
76 _overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
81 rm -rf $tmp/{upper,work}
82 mkdir -p $tmp/{upper,work}
83 # mount overlay again using SCRATCH_MNT dir
84 _overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \