2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 CTERA Networks. All Rights Reserved.
7 # Test file handle decode with multi lower layers on same fs
9 # This test is for a regression that was introduced in kernel v4.17 by
10 # commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding
11 # lower file handle").
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
26 $UMOUNT_PROG $lowertestdir
29 # get standard environment, filters and checks
33 # real QA test starts here
37 _require_test_program "open_by_handle"
38 # We need to require all features together, because nfs_export cannot
39 # be enabled when index is disabled
40 _require_scratch_overlay_features index nfs_export
44 # Create test dir and empty test files
50 $here/src/open_by_handle -cwp $dir $NUMFILES
53 # Test encode/decode file handles on overlay mount
58 $here/src/open_by_handle -rp $dir $NUMFILES
63 # All lower layers are on scratch partition
64 lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
65 lower2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
66 lowertestdir=$lower2/testdir
68 create_test_files $lowertestdir
70 # bind mount to pin lower test dir dentry to dcache
71 $MOUNT_PROG --bind $lowertestdir $lowertestdir
73 # For non-upper overlay mount, nfs_export requires disabling redirect_dir.
74 $MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \
75 -o ro,redirect_dir=nofollow,nfs_export=on,lowerdir=$lower:$lower2
77 # Decode an overlay directory file handle, whose underlying lower dir dentry
78 # is in dcache and connected and does not belong to the upper most lower layer.
79 # The test program drops caches, but $lowertestdir dcache in pinned, so only
80 # the overlay dentry is dropped.
81 test_file_handles $SCRATCH_MNT/testdir -rp
83 echo "Silence is golden"