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 _begin_fstest auto quick exportfs
16 # Override the default cleanup function.
21 $UMOUNT_PROG $lowertestdir
24 # Import common functions.
27 # real QA test starts here
31 _require_test_program "open_by_handle"
32 # We need to require all features together, because nfs_export cannot
33 # be enabled when index is disabled
34 _require_scratch_overlay_features index nfs_export
38 # Create test dir and empty test files
44 $here/src/open_by_handle -cwp $dir $NUMFILES
47 # Test encode/decode file handles on overlay mount
52 $here/src/open_by_handle -rp $dir $NUMFILES
57 # All lower layers are on scratch partition
58 lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
59 lower2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
60 lowertestdir=$lower2/testdir
62 create_test_files $lowertestdir
64 # bind mount to pin lower test dir dentry to dcache
65 $MOUNT_PROG --bind $lowertestdir $lowertestdir
67 # For non-upper overlay mount, nfs_export requires disabling redirect_dir.
68 $MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \
69 -o ro,redirect_dir=nofollow,nfs_export=on,lowerdir=$lower:$lower2
71 # Decode an overlay directory file handle, whose underlying lower dir dentry
72 # is in dcache and connected and does not belong to the upper most lower layer.
73 # The test program drops caches, but $lowertestdir dcache in pinned, so only
74 # the overlay dentry is dropped.
75 test_file_handles $SCRATCH_MNT/testdir -rp
77 echo "Silence is golden"