fstests: move test group info to test files
[xfstests-dev.git] / tests / overlay / 076
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2021 CTERA Networks. All Rights Reserved.
4 #
5 # FS QA Test 076
6 #
7 # Support for chattr on overlayfs directories was added in kernel v5.10
8 # by commit 61536bed2149 ("ovl: support [S|G]ETFLAGS and FS[S|G]ETXATTR
9 # ioctls for directories").  That commit introduced a deadlock.
10 #
11 # This is a regression test for the fix commit b854cc659dcb ("ovl: avoid
12 # deadlock on directory ioctl")
13 #
14 . ./common/preamble
15 _begin_fstest auto quick perms dangerous
16
17 # Override the default cleanup function.
18 _cleanup()
19 {
20         cd /
21         $CHATTR_PROG -i $lowerdir/foo > /dev/null 2>&1
22         $CHATTR_PROG -i $upperdir/foo > /dev/null 2>&1
23         rm -f $tmp.*
24 }
25
26 # Import common functions.
27 . ./common/filter
28
29 # real QA test starts here
30 _supported_fs overlay
31 _require_scratch
32 _require_chattr i
33
34 # remove all files from previous runs
35 _scratch_mkfs
36
37 # prepare lower test file
38 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
39 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
40 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
41 mkdir -p $lowerdir
42 mkdir $lowerdir/foo
43
44 # mounting overlay
45 _scratch_mount
46
47 # Try to add the immutable attributes, it will invoke ioctl() on the directory
48 # The ioctl will fail on kernel < 5.10, succeed on kernel >= 5.10.15 and hang
49 # on kernel v5.10..v5.10.14.  Anything but hang is considered a test success.
50 $CHATTR_PROG +i $SCRATCH_MNT/foo > /dev/null 2>&1
51
52 $UMOUNT_PROG $SCRATCH_MNT
53
54 # success, all done
55 echo "Silence is golden"
56 status=0
57 exit