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 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # real QA test starts here
33 # Modify as appropriate.
36 # _require_exportfs already requires open_by_handle, but let's not count on it
37 _require_test_program "open_by_handle"
41 testroot=$TEST_DIR/$seq-dir
42 testdir=$testroot/testdir
44 # Create test dir and test files, encode file handles and store to tmp file
49 $here/src/open_by_handle -cwp -o $tmp.handles_file $testdir $NUMFILES
52 # Decode file handles loaded from tmp file
58 echo test_file_handles after $when
59 $here/src/open_by_handle $opt -i $tmp.handles_file $TEST_DIR $NUMFILES
62 # Decode file handles of files/dir after cycle mount
65 test_file_handles -rp "cycle mount"
67 # Decode file handles of files/dir after rename of parent and cycle mount
68 create_test_files $testdir
69 rm -rf $testdir.renamed
70 mv $testdir $testdir.renamed/
72 test_file_handles -rp "rename parent"
74 # Decode file handles of files/dir after rename of grandparent and cycle mount
75 create_test_files $testdir
76 rm -rf $testroot.renamed
77 mv $testroot $testroot.renamed/
79 test_file_handles -rp "rename grandparent"
81 # Decode file handles of files/dir after move to new parent and cycle mount
82 create_test_files $testdir
85 mv $testdir/* $testdir.new/
87 test_file_handles -r "move to new parent"