2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2021 CTERA Networks. All Rights Reserved.
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.
11 # This is a regression test for the fix commit b854cc659dcb ("ovl: avoid
12 # deadlock on directory ioctl")
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
26 $CHATTR_PROG -i $lowerdir/foo > /dev/null 2>&1
27 $CHATTR_PROG -i $upperdir/foo > /dev/null 2>&1
31 # get standard environment, filters and checks
35 # remove previous $seqres.full before test
38 # real QA test starts here
43 # remove all files from previous runs
46 # prepare lower test file
47 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
48 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
49 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
56 # Try to add the immutable attributes, it will invoke ioctl() on the directory
57 # The ioctl will fail on kernel < 5.10, succeed on kernel >= 5.10.15 and hang
58 # on kernel v5.10..v5.10.14. Anything but hang is considered a test success.
59 $CHATTR_PROG +i $SCRATCH_MNT/foo > /dev/null 2>&1
61 $UMOUNT_PROG $SCRATCH_MNT
64 echo "Silence is golden"