2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
7 # If underlying upper file is immutable, it should stays
8 # untouchable in the overlayfs mount.
10 # Kernel commit below fixed it.
11 # f2b20f6ee842 vfs: move permission checking into ...
13 # This reproducer was originally written by
14 # Miklos Szeredi <mszeredi@redhat.com>
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 $upperdir/foo
32 # get standard environment, filters and checks
36 # remove previous $seqres.full before test
39 # real QA test starts here
41 # Modify as appropriate.
46 # Remove all files from previous tests
49 # Preparing immutable file
50 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
53 $CHATTR_PROG +i $upperdir/foo
58 # Touching immutable file in overlay, should fail.
59 # Not filtering output here because of errno returned
60 # varies among kernel versions:
61 # touch: setting times of 'foo': Operation not permitted
62 # touch: cannot touch 'foo': Permission denied
63 if touch $SCRATCH_MNT/foo > /dev/null 2>&1 ; then
64 echo "Test Fail, you can't change an immutable file"
66 echo "Silence is golden"