2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Huawei. All Rights Reserved.
7 # chattr with [iap..] attributes open file for read-only and
8 # invoke ioctl(). If we chattr a lower file in overlay, it
9 # will get the lower file but not trigger copy-up, so ioctl()
10 # lead to modification of that lower file.
12 # Upstream Commit 7c6893e3c9ab ("ovl: don't allow writing
13 # ioctl on lower layer") return EPERM for this case to avoid
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
22 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
28 $CHATTR_PROG -i $lowerdir/foo > /dev/null 2>&1
29 $CHATTR_PROG -i $upperdir/foo > /dev/null 2>&1
33 # get standard environment, filters and checks
37 # remove previous $seqres.full before test
40 # real QA test starts here
46 # remove all files from previous runs
49 # prepare lower test file
50 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
51 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
58 # Try to add immutable attributes in overlay, it will
59 # open file for read-only and invoke ioctl(), it should not
60 # modify lower origin file.
61 $CHATTR_PROG +i $SCRATCH_MNT/foo > /dev/null 2>&1
63 $UMOUNT_PROG $SCRATCH_MNT
65 # touching origin file in lower, should succeed
69 echo "Silence is golden"