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 _begin_fstest auto quick perms dangerous
17 # Override the default cleanup function.
21 $CHATTR_PROG -i $lowerdir/foo > /dev/null 2>&1
22 $CHATTR_PROG -i $upperdir/foo > /dev/null 2>&1
26 # Import common functions.
29 # real QA test starts here
34 # remove all files from previous runs
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
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
52 $UMOUNT_PROG $SCRATCH_MNT
55 echo "Silence is golden"