4 # Test cases that force read-only mount
7 # - Failure to create work dir
9 #-----------------------------------------------------------------------
10 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
11 # Author: Amir Goldstein <amir73il@gmail.com>
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
40 $CHATTR_PROG -i $workdir
44 # get standard environment, filters and checks
48 # remove previous $seqres.full before test
51 # real QA test starts here
57 # Remove all files from previous tests
60 # Create multiple lowerdirs and upperdir, workdir
61 lowerdir1=$OVL_BASE_SCRATCH_MNT/lower1
62 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
63 upperdir=$OVL_BASE_SCRATCH_MNT/upper
64 workdir=$OVL_BASE_SCRATCH_MNT/workdir
65 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
67 # Mount overlay with lower layers only.
68 # Verify that overlay is mounted read-only and that it cannot be remounted rw.
69 $MOUNT_PROG -t overlay -o"lowerdir=$lowerdir2:$lowerdir1" \
70 $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
71 touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
72 _scratch_remount rw 2>&1 | _filter_ro_mount
73 $UMOUNT_PROG $SCRATCH_MNT
75 # Make workdir immutable to prevent workdir re-create on mount
76 $CHATTR_PROG +i $workdir
78 # Mount overlay with upper and workdir and expect failure to re-create workdir.
79 # Verify that overlay is mounted read-only and that it cannot be remounted rw.
80 _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir
81 touch $SCRATCH_MNT/bar 2>&1 | _filter_scratch
82 _scratch_remount rw 2>&1 | _filter_ro_mount