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
54 # Use non-default scratch underlying overlay dirs, we need to check
55 # them explicity after test.
56 _require_scratch_nocheck
59 # Remove all files from previous tests
62 # Create multiple lowerdirs and upperdir, workdir
63 lowerdir1=$OVL_BASE_SCRATCH_MNT/lower1
64 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
65 upperdir=$OVL_BASE_SCRATCH_MNT/upper
66 workdir=$OVL_BASE_SCRATCH_MNT/workdir
67 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
69 # Mount overlay with lower layers only.
70 # Verify that overlay is mounted read-only and that it cannot be remounted rw.
71 $MOUNT_PROG -t overlay -o"lowerdir=$lowerdir2:$lowerdir1" \
72 $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
73 touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
74 _scratch_remount rw 2>&1 | _filter_ro_mount
75 $UMOUNT_PROG $SCRATCH_MNT
77 # Make workdir immutable to prevent workdir re-create on mount
78 $CHATTR_PROG +i $workdir
80 # Mount overlay with upper and workdir and expect failure to re-create workdir.
81 # Verify that overlay is mounted read-only and that it cannot be remounted rw.
82 _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir
83 touch $SCRATCH_MNT/bar 2>&1 | _filter_scratch
84 _scratch_remount rw 2>&1 | _filter_ro_mount
87 _overlay_check_scratch_dirs $lowerdir2 $upperdir $workdir