overlay/029: fix test failure with nfs_export feature enabled
[xfstests-dev.git] / tests / overlay / 030
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
4 #
5 # FS QA Test No. 030
6 #
7 # Run the t_immutable test program for immutable/append-only files
8 # and directories in an overlayfs upper directory.
9 #
10 # This test is similar and was derived from generic/079, but
11 # the original test is _notrun on overlay mount because FS_IOC_GETFLAGS
12 # FS_IOC_SETFLAGS ioctls fail on overlay directory inodes.
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 timmutable=$here/src/t_immutable
20 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
21 tmp=/tmp/$$
22 status=1        # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27         $timmutable -r $upperdir/t_immutable &> /dev/null
28         rm -f $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34
35 _supported_fs overlay
36 _supported_os Linux
37
38 _require_chattr ia
39 _require_test_program "t_immutable"
40 _require_scratch
41
42 _scratch_mkfs
43
44 # Preparing immutable files in uppper dir
45 mkdir -p $upperdir
46 $timmutable -C $upperdir/t_immutable >$tmp.out 2>&1
47 if grep -q -e 'Operation not supported' -e "Inappropriate ioctl" $tmp.out; then
48         _notrun "Setting immutable/append flag not supported"
49 fi
50
51 _scratch_mount
52
53 # Test immutability of files in overlay
54 $timmutable $SCRATCH_MNT/t_immutable 2>&1
55 status=$?
56 exit