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.
37 # _require_exportfs already requires open_by_handle, but let's not count on it
38 _require_test_program "open_by_handle"
42 testroot=$TEST_DIR/$seq-dir
43 testdir=$testroot/testdir
45 # Create test dir and test files, encode file handles and store to tmp file
50 $here/src/open_by_handle -cwp -o $tmp.handles_file $testdir $NUMFILES
53 # Decode file handles loaded from tmp file
59 echo test_file_handles after $when
60 $here/src/open_by_handle $opt -i $tmp.handles_file $TEST_DIR $NUMFILES
63 # Decode file handles of files/dir after cycle mount
66 test_file_handles -rp "cycle mount"
68 # Decode file handles of files/dir after rename of parent and cycle mount
69 create_test_files $testdir
70 rm -rf $testdir.renamed
71 mv $testdir $testdir.renamed/
73 test_file_handles -rp "rename parent"
75 # Decode file handles of files/dir after rename of grandparent and cycle mount
76 create_test_files $testdir
77 rm -rf $testroot.renamed
78 mv $testroot $testroot.renamed/
80 test_file_handles -rp "rename grandparent"
82 # Decode file handles of files/dir after move to new parent and cycle mount
83 create_test_files $testdir
86 mv $testdir/* $testdir.new/
88 test_file_handles -r "move to new parent"