mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
8e1e3cd84f
This test is for a regression that was introduced in kernel v4.17 by
commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding
lower file handle").
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
87 lines
2.1 KiB
Bash
Executable File
87 lines
2.1 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2018 CTERA Networks. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 062
|
|
#
|
|
# Test file handle decode with multi lower layers on same fs
|
|
#
|
|
# This test is for a regression that was introduced in kernel v4.17 by
|
|
# commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding
|
|
# lower file handle").
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.*
|
|
$UMOUNT_PROG $lowertestdir
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
|
|
_supported_fs overlay
|
|
_supported_os Linux
|
|
_require_scratch
|
|
_require_test_program "open_by_handle"
|
|
# We need to require all features together, because nfs_export cannot
|
|
# be enabled when index is disabled
|
|
_require_scratch_overlay_features index nfs_export
|
|
|
|
NUMFILES=1
|
|
|
|
# Create test dir and empty test files
|
|
create_test_files()
|
|
{
|
|
local dir=$1
|
|
|
|
mkdir -p $dir
|
|
$here/src/open_by_handle -cwp $dir $NUMFILES
|
|
}
|
|
|
|
# Test encode/decode file handles on overlay mount
|
|
test_file_handles()
|
|
{
|
|
local dir=$1
|
|
|
|
$here/src/open_by_handle -rp $dir $NUMFILES
|
|
}
|
|
|
|
_scratch_mkfs
|
|
|
|
# All lower layers are on scratch partition
|
|
lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
|
|
lower2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
|
|
lowertestdir=$lower2/testdir
|
|
|
|
create_test_files $lowertestdir
|
|
|
|
# bind mount to pin lower test dir dentry to dcache
|
|
$MOUNT_PROG --bind $lowertestdir $lowertestdir
|
|
|
|
# For non-upper overlay mount, nfs_export requires disabling redirect_dir.
|
|
$MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \
|
|
-o ro,redirect_dir=nofollow,nfs_export=on,lowerdir=$lower:$lower2
|
|
|
|
# Decode an overlay directory file handle, whose underlying lower dir dentry
|
|
# is in dcache and connected and does not belong to the upper most lower layer.
|
|
# The test program drops caches, but $lowertestdir dcache in pinned, so only
|
|
# the overlay dentry is dropped.
|
|
test_file_handles $SCRATCH_MNT/testdir -rp
|
|
|
|
echo "Silence is golden"
|
|
status=0
|
|
exit
|