2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
7 # Check open by file handle.
8 # This is a variant of test generic/426 that tests with less
9 # files and more use cases:
10 # - open directory by file handle
11 # - verify content integrity of file after opening by file handle
12 # - open by file handle of unlinked open files
13 # - open by file handle of renamed files
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
34 # real QA test starts here
36 # Modify as appropriate.
39 # _require_exportfs already requires open_by_handle, but let's not count on it
40 _require_test_program "open_by_handle"
44 testdir=$TEST_DIR/$seq-dir
46 # Create test dir and non-empty test files
53 $here/src/open_by_handle -cwp $dir $NUMFILES
56 # Test encode/decode file handles
62 echo test_file_handles $* | _filter_test_dir
63 $here/src/open_by_handle $opt $dir $NUMFILES
66 # Check stale handles to deleted files/dir
67 create_test_files $testdir
68 test_file_handles $testdir -dp
70 # Check non-stale handles to linked files/dir
71 create_test_files $testdir
72 test_file_handles $testdir -rp
74 # Check non-stale handles to unlinked open files
75 create_test_files $testdir
76 test_file_handles $testdir -dkr
78 # Check non-stale handles to files that were hardlinked and original deleted
79 create_test_files $testdir
80 test_file_handles $testdir -lr
81 test_file_handles $testdir -ur
83 # Check non-stale file handles of renamed files
84 create_test_files $testdir
85 test_file_handles $testdir -mr
87 # Check non-stale file handles after rename of parent
88 create_test_files $testdir
89 rm -rf $testdir.renamed
90 mv $testdir $testdir.renamed/
91 test_file_handles $testdir.renamed -rp
93 # Check non-stale file handles after move to new parent
94 create_test_files $testdir
97 mv $testdir/* $testdir.new/
98 test_file_handles $testdir.new -rp