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.
40 # _require_exportfs already requires open_by_handle, but let's not count on it
41 _require_test_program "open_by_handle"
45 testdir=$TEST_DIR/$seq-dir
47 # Create test dir and non-empty test files
54 $here/src/open_by_handle -cwp $dir $NUMFILES
57 # Test encode/decode file handles
63 echo test_file_handles $* | _filter_test_dir
64 $here/src/open_by_handle $opt $dir $NUMFILES
67 # Check stale handles to deleted files/dir
68 create_test_files $testdir
69 test_file_handles $testdir -dp
71 # Check non-stale handles to linked files/dir
72 create_test_files $testdir
73 test_file_handles $testdir -rp
75 # Check non-stale handles to unlinked open files
76 create_test_files $testdir
77 test_file_handles $testdir -dkr
79 # Check non-stale handles to files that were hardlinked and original deleted
80 create_test_files $testdir
81 test_file_handles $testdir -lr
82 test_file_handles $testdir -ur
84 # Check non-stale file handles of renamed files
85 create_test_files $testdir
86 test_file_handles $testdir -mr
88 # Check non-stale file handles after rename of parent
89 create_test_files $testdir
90 rm -rf $testdir.renamed
91 mv $testdir $testdir.renamed/
92 test_file_handles $testdir.renamed -rp
94 # Check non-stale file handles after move to new parent
95 create_test_files $testdir
98 mv $testdir/* $testdir.new/
99 test_file_handles $testdir.new -rp