2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 CTERA Networks. All Rights Reserved.
7 # Check open by file handle after cycle mount.
9 # This test uses load and store of file handles from a temp file to test
10 # decoding file handles after cycle mount and after directory renames.
13 _begin_fstest auto quick exportfs
15 # Import common functions.
18 # real QA test starts here
20 # Modify as appropriate.
23 # _require_exportfs already requires open_by_handle, but let's not count on it
24 _require_test_program "open_by_handle"
28 testroot=$TEST_DIR/$seq-dir
29 testdir=$testroot/testdir
31 # Create test dir and test files, encode file handles and store to tmp file
36 $here/src/open_by_handle -cwp -o $tmp.handles_file $testdir $NUMFILES
39 # Decode file handles loaded from tmp file
45 echo test_file_handles after $when
46 $here/src/open_by_handle $opt -i $tmp.handles_file $TEST_DIR $NUMFILES
49 # Decode file handles of files/dir after cycle mount
52 test_file_handles -rp "cycle mount"
54 # Decode file handles of files/dir after rename of parent and cycle mount
55 create_test_files $testdir
56 rm -rf $testdir.renamed
57 mv $testdir $testdir.renamed/
59 test_file_handles -rp "rename parent"
61 # Decode file handles of files/dir after rename of grandparent and cycle mount
62 create_test_files $testdir
63 rm -rf $testroot.renamed
64 mv $testroot $testroot.renamed/
66 test_file_handles -rp "rename grandparent"
68 # Decode file handles of files/dir after move to new parent and cycle mount
69 create_test_files $testdir
72 mv $testdir/* $testdir.new/
74 test_file_handles -r "move to new parent"