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 _begin_fstest auto quick exportfs
18 # Import common functions.
21 # real QA test starts here
23 # Modify as appropriate.
26 # _require_exportfs already requires open_by_handle, but let's not count on it
27 _require_test_program "open_by_handle"
31 testdir=$TEST_DIR/$seq-dir
33 # Create test dir and non-empty test files
40 $here/src/open_by_handle -cwp $dir $NUMFILES
43 # Test encode/decode file handles
49 echo test_file_handles $* | _filter_test_dir
50 $here/src/open_by_handle $opt $dir $NUMFILES
53 # Check stale handles to deleted files/dir
54 create_test_files $testdir
55 test_file_handles $testdir -dp
57 # Check non-stale handles to linked files/dir
58 create_test_files $testdir
59 test_file_handles $testdir -rp
61 # Check non-stale handles to unlinked open files
62 create_test_files $testdir
63 test_file_handles $testdir -dkr
65 # Check non-stale handles to files that were hardlinked and original deleted
66 create_test_files $testdir
67 test_file_handles $testdir -lr
68 test_file_handles $testdir -ur
70 # Check non-stale file handles of renamed files
71 create_test_files $testdir
72 test_file_handles $testdir -mr
74 # Check non-stale file handles after rename of parent
75 create_test_files $testdir
76 rm -rf $testdir.renamed
77 mv $testdir $testdir.renamed/
78 test_file_handles $testdir.renamed -rp
80 # Check non-stale file handles after move to new parent
81 create_test_files $testdir
84 mv $testdir/* $testdir.new/
85 test_file_handles $testdir.new -rp