xfstests: add parent pointer tests
v2 cover xfstests: add parent pointer tests
Hi all,
These are the tests for Allison's parent pointer series:
https://lore.kernel.org/linux-xfs/[email protected]/
These tests cover basic parent pointer operations, multiple links, and error inject. This patch also adds a new parent group and parent common functions.
v1->v2:
- Print name and length of bad parent pointer
- Remove line that explicitly turns on LARP mode
- Remove unnecessary empty lines
- Split single patch into multiple patches
- Add _require_xfs_parent function
- Check that mkfs/kernel/xfs_io supports parent pointers
Comments and feedback appreciated!
Catherine
Allison Henderson (4):
common: add helpers for parent pointer tests
xfs: add parent pointer test
xfs: add multi link parent pointer test
xfs: add parent pointer inject test
common/parent | 198 +++++++++ common/rc | 3 + common/xfs | 12 + doc/group-names.txt | 1 + tests/xfs/554 | 125 ++++++ tests/xfs/554.out | 59 +++ tests/xfs/555 | 96 +++++ tests/xfs/555.out | 1002 +++++++++++++++++++++++++++++++++++++++++++ tests/xfs/556 | 110 +++++ tests/xfs/556.out | 14 + 10 files changed, 1620 insertions(+) create mode 100644 common/parent create mode 100755 tests/xfs/554 create mode 100644 tests/xfs/554.out create mode 100755 tests/xfs/555 create mode 100644 tests/xfs/555.out create mode 100755 tests/xfs/556 create mode 100644 tests/xfs/556.out
Signature · 1 line
2.25.1
PATCH v2 1/4 common: add helpers for parent pointer tests
From: Allison Henderson <[email protected]>
Add helper functions in common/parent to parse and verify parent pointers. Also add functions to check that mkfs, kernel, and xfs_io support parent pointers.
--- common/parent | 198 ++++++++++++++++++++++++++++++++++++++++++++++++++ common/rc | 3 + common/xfs | 12 +++ 3 files changed, 213 insertions(+) create mode 100644 common/parent
common/parent new file +198 -0
@@ -0,0 +1,198 @@ +# +# Parent pointer common functions +# + +# +# parse_parent_pointer parents parent_inode parent_pointer_name +# +# Given a list of parent pointers, find the record that matches +# the given inode and filename +# +# inputs: +# parents : A list of parent pointers in the format of: +# inode/generation/name_length/name +# parent_inode : The parent inode to search for +# parent_name : The parent name to search for +# +# outputs: +# PPINO : Parent pointer inode +# PPGEN : Parent pointer generation +# PPNAME : Parent pointer name +# PPNAME_LEN : Parent pointer name length +# +_parse_parent_pointer() +{ + local parents=$1 + local pino=$2 + local parent_pointer_name=$3 + + local found=0 + + # Find the entry that has the same inode as the parent + # and parse out the entry info + while IFS=\/ read PPINO PPGEN PPNAME_LEN PPNAME; do + if [ "$PPINO" != "$pino" ]; then + continue + fi + + if [ "$PPNAME" != "$parent_pointer_name" ]; then + continue + fi + + found=1 + break + done <<< $(echo "$parents") + + # Check to see if we found anything + # We do not fail the test because we also use this + # routine to verify when parent pointers should + # be removed or updated (ie a rename or a move + # operation changes your parent pointer) + if [ $found -eq "0" ]; then + return 1 + fi + + # Verify the parent pointer name length is correct + if [ "$PPNAME_LEN" -ne "${#parent_pointer_name}" ] + then + echo "*** Bad parent pointer:"\ + "name:$PPNAME, namelen:$PPNAME_LEN" + fi + + #return sucess + return 0 +} + +# +# _verify_parent parent_path parent_pointer_name child_path +# +# Verify that the given child path lists the given parent as a parent pointer +# and that the parent pointer name matches the given name +# +# Examples: +# +# #simple example +# mkdir testfolder1 +# touch testfolder1/file1 +# verify_parent testfolder1 file1 testfolder1/file1 +# +# # In this above example, we want to verify that "testfolder1" +# # appears as a parent pointer of "testfolder1/file1". Additionally +# # we verify that the name record of the parent pointer is "file1" +# +# +# #hardlink example +# mkdir testfolder1 +# mkdir testfolder2 +# touch testfolder1/file1 +# ln testfolder1/file1 testfolder2/file1_ln +# verify_parent testfolder2 file1_ln testfolder1/file1 +# +# # In this above example, we want to verify that "testfolder2" +# # appears as a parent pointer of "testfolder1/file1". Additionally +# # we verify that the name record of the parent pointer is "file1_ln" +# +_verify_parent() +{ + local parent_path=$1 + local parent_pointer_name=$2 + local child_path=$3 + + local parent_ppath="$parent_path/$parent_pointer_name" + + # Verify parent exists + if [ ! -d $SCRATCH_MNT/$parent_path ]; then + _fail "$SCRATCH_MNT/$parent_path not found" + else + echo "*** $parent_path OK" + fi + + # Verify child exists + if [ ! -f $SCRATCH_MNT/$child_path ]; then + _fail "$SCRATCH_MNT/$child_path not found" + else + echo "*** $child_path OK" + fi + + # Verify the parent pointer name exists as a child of the parent + if [ ! -f $SCRATCH_MNT/$parent_ppath ]; then + _fail "$SCRATCH_MNT/$parent_ppath not found" + else + echo "*** $parent_ppath OK" + fi + + # Get the inodes of both parent and child + pino="$(stat -c '%i' $SCRATCH_MNT/$parent_path)" + cino="$(stat -c '%i' $SCRATCH_MNT/$child_path)" + + # Get all the parent pointers of the child + parents=($($XFS_IO_PROG -x -c \ + "parent -f -i $pino -n $parent_pointer_name" $SCRATCH_MNT/$child_path)) + if [[ $? != 0 ]]; then + _fail "No parent pointers found for $child_path" + fi + + # Parse parent pointer output. + # This sets PPINO PPGEN PPNAME PPNAME_LEN + _parse_parent_pointer $parents $pino $parent_pointer_name + + # If we didnt find one, bail out + if [ $? -ne 0 ]; then + _fail "No parent pointer record found for $parent_path"\ + "in $child_path" + fi + + # Verify the inode generated by the parent pointer name is + # the same as the child inode + pppino="$(stat -c '%i' $SCRATCH_MNT/$parent_ppath)" + if [ $cino -ne $pppino ] + then + _fail "Bad parent pointer name value for $child_path."\ + "$SCRATCH_MNT/$parent_ppath belongs to inode $PPPINO,"\ + "but should be $cino" + fi + + echo "*** Verified parent pointer:"\ + "name:$PPNAME, namelen:$PPNAME_LEN" + echo "*** Parent pointer OK for child $child_path" +} + +# +# _verify_parent parent_pointer_name pino child_path +# +# Verify that the given child path contains no parent pointer entry +# for the given inode and file name +# +_verify_no_parent() +{ + local parent_pname=$1 + local pino=$2 + local child_path=$3 + + # Verify child exists + if [ ! -f $SCRATCH_MNT/$child_path ]; then + _fail "$SCRATCH_MNT/$child_path not found" + else + echo "*** $child_path OK" + fi + + # Get all the parent pointers of the child + local parents=($($XFS_IO_PROG -x -c \ + "parent -f -i $pino -n $parent_pname" $SCRATCH_MNT/$child_path)) + if [[ $? != 0 ]]; then + return 0 + fi + + # Parse parent pointer output. + # This sets PPINO PPGEN PPNAME PPNAME_LEN + _parse_parent_pointer $parents $pino $parent_pname + + # If we didnt find one, return sucess + if [ $? -ne 0 ]; then + return 0 + fi + + _fail "Parent pointer entry found where none should:"\ + "inode:$PPINO, gen:$PPGEN," + "name:$PPNAME, namelen:$PPNAME_LEN" +}
common/rc +3 -0
@@ -2539,6 +2539,9 @@ _require_xfs_io_command() echo $testio | grep -q "invalid option" && \ _notrun "xfs_io $command support is missing" ;; + "parent") + testio=`$XFS_IO_PROG -x -c "parent" $TEST_DIR 2>&1` + ;; "pwrite") # -N (RWF_NOWAIT) only works with direct vectored I/O writes local pwrite_opts=" "
common/xfs +12 -0
@@ -1399,3 +1399,15 @@ _xfs_filter_mkfs() print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n"; }' } + +# this test requires the xfs parent pointers feature +# +_require_xfs_parent() +{ + _scratch_mkfs_xfs_supported -n parent > /dev/null 2>&1 \ + || _notrun "mkfs.xfs does not support parent pointers" + _scratch_mkfs_xfs -n parent > /dev/null 2>&1 + _try_scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel does not support parent pointers" + _scratch_unmount +}
Signature · 1 line
2.25.1
PATCH v2 2/4 xfs: add parent pointer test
In reply to Catherine HoangFrom: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link, unlink, rename, overwrite).
--- doc/group-names.txt | 1 + tests/xfs/554 | 125 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/554.out | 59 +++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100755 tests/xfs/554 create mode 100644 tests/xfs/554.out
doc/group-names.txt +1 -0
@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access control lists nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group +parent Parent pointer tests pattern specific IO pattern tests perms access control and permission checking pipe pipe functionality
tests/xfs/554 new file +125 -0
125 lines not on this page · raw message
tests/xfs/554.out new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 2/4] xfs: add parent pointer test
Quoted 40 lines · Catherine Hoang
From: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link, unlink, rename, overwrite).
Signed-off-by Allison Henderson <[email protected]>Signed-off-by Catherine Hoang <[email protected]>--- doc/group-names.txt | 1 + tests/xfs/554 | 125 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/554.out | 59 +++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100755 tests/xfs/554 create mode 100644 tests/xfs/554.outdoc/group-names.txt +1
-0@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access control lists nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group +parent Parent pointer tests pattern specific IO pattern tests perms access control and permission checking pipe pipe functionalitytests/xfs/554 new file +7
-0@@ -0,0 +1,125 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 554 +# +# simple parent pointer test
tests/xfs/554 line 17
Quoted 10 lines
tests/xfs/554 new file +10
-0+# + +. ./common/preamble +_begin_fstest auto quick parent + +cleanup() +{ + cd / + rm -f $tmp.* +}
This's same with common cleanup function, you can remove this function.
tests/xfs/554 line 24
Quoted 7 lines
tests/xfs/554 new file +7
-0+ +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +}
What's this function for? I didn't see this function is called in this case. Am I missing something?
Quoted 32 lines
tests/xfs/554 new file +32
-0+ +# get standard environment, filters and checks +. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp" +_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the root
tests/xfs/554 line 66
Quoted 10 lines
tests/xfs/554 new file +10
-0+testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fi
It just writes a general file, right? Is there any special reason might cause write fail?
I think we don't need to check each step's return value. And if we fail to write a file, bash helps to output error message to break golden image too.
Thanks,
Zorro
Quoted 127 lines
tests/xfs/554 new file +59
-0+ +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1 $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1 $SCRATCH_MNT/$testfolder1/$file1_ln +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1" "$testfolder1/$file1_ln" +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3 $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exittests/xfs/554.out new file +59
-0@@ -0,0 +1,59 @@ +QA output created by 554 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2Signature · 1 line
2.25.1
Re: [PATCH v2 2/4] xfs: add parent pointer test
Quoted 45 lines · Zorro Lang
Quoted 44 lines · Catherine Hoang
From: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link, unlink, rename, overwrite).
Signed-off-by Allison Henderson <[email protected]>Signed-off-by Catherine Hoang <[email protected]>--- doc/group-names.txt | 1 + tests/xfs/554 | 125 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/554.out | 59 +++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100755 tests/xfs/554 create mode 100644 tests/xfs/554.outdoc/group-names.txt +1
-0@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access control lists nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group +parent Parent pointer tests pattern specific IO pattern tests perms access control and permission checking pipe pipe functionalitytests/xfs/554 new file +11
-0@@ -0,0 +1,125 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 554 +# +# simple parent pointer test +# + +. ./common/preamble +_begin_fstest auto quick parent
Quoted 8 lines
tests/xfs/554 line 17
Quoted 6 lines
tests/xfs/554 new file +6
-0+ +cleanup() +{ + cd / + rm -f $tmp.* +}This's same with common cleanup function, you can remove this function.
Same for patch 3 and 4.
Quoted 11 lines
tests/xfs/554 line 24
Quoted 8 lines
tests/xfs/554 new file +7
-0+ +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +}What's this function for? I didn't see this function is called in this case. Am I missing something?
Same question for patch 3 and 4.
Quoted 13 lines
tests/xfs/554 line 36
Quoted 13 lines
tests/xfs/554 new file +12
-0+ +# get standard environment, filters and checks +. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp"
And does this case really do error injection? I didn't find that. If not, please remove this requirement and above common/inject. Same question for patch 4.
Thanks,
Zorro
Quoted 167 lines
Quoted 20 lines
tests/xfs/554 new file +20
-0+_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the roottests/xfs/554 line 66
Quoted 10 lines
tests/xfs/554 new file +10
-0+testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fiIt just writes a general file, right? Is there any special reason might cause write fail?
I think we don't need to check each step's return value. And if we fail to write a file, bash helps to output error message to break golden image too.
Thanks,
ZorroQuoted 127 lines
tests/xfs/554 new file +59
-0+ +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1 $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1 $SCRATCH_MNT/$testfolder1/$file1_ln +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1" "$testfolder1/$file1_ln" +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3 $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exittests/xfs/554.out new file +59
-0@@ -0,0 +1,59 @@ +QA output created by 554 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2Signature · 1 line
2.25.1
Re: [PATCH v2 2/4] xfs: add parent pointer test
Quoted 76 lines · Zorro Lang
Quoted 51 lines · Zorro Lang
Quoted 50 lines · Catherine Hoang
From: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link,
unlink, rename, overwrite).Signed-off-by Allison Henderson <[email protected]>Signed-off-by Catherine Hoang <[email protected]>---
doc/group-names.txt | 1 +
tests/xfs/554 | 125
++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/554.out | 59 +++++++++++++++++++++3 files changed, 185 insertions(+)create mode 100755 tests/xfs/554
create mode 100644 tests/xfs/554.outdoc/group-names.txt +0
-0@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access controllists
nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group
+parent Parent pointer tests
pattern specific IO pattern tests perms access control and permission checking pipe pipe functionalitytests/xfs/554 new file +3
-0@@ -0,0 +1,125 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All RightsReserved.
tests/xfs/554 new file +9
-0+# +# FS QA Test 554 +# +# simple parent pointer test +# + +. ./common/preamble +_begin_fstest auto quick parent +Quoted 8 lines
tests/xfs/554 line 17
Quoted 5 lines
tests/xfs/554 new file +5
-0+cleanup() +{ + cd / + rm -f $tmp.* +}This's same with common cleanup function, you can remove this function.
Same for patch 3 and 4.
Quoted 12 lines
tests/xfs/554 line 24
Quoted 8 lines
tests/xfs/554 new file +7
-0+ +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +}What's this function for? I didn't see this function is called in this case.
Am I missing something?
Quoted 1 line
Same question for patch 3 and 4.
Think I answered these in the other patch review...
Quoted 18 lines
Quoted 14 lines
Quoted 4 lines
tests/xfs/554 new file +2
-0+ +# get standard environment, filters and checkstests/xfs/554 line 36
Quoted 10 lines
tests/xfs/554 new file +10
-0+. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp"And does this case really do error injection? I didn't find that. If not, please
remove this requirement and above common/inject.
I think at one point I had all these tests in one file and then later separated them into multiple tests. So I think the requirements for injects can be removed from patch 2 and 3
Quoted 1 line
Same question for patch 4.
Patch 4 does do injects, so the requirement should stay.
Allison
Quoted 182 lines
Thanks,
ZorroQuoted 177 lines
Quoted 20 lines
tests/xfs/554 new file +20
-0+_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the roottests/xfs/554 line 66
Quoted 10 lines
tests/xfs/554 new file +10
-0+testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fiIt just writes a general file, right? Is there any special reason might cause
write fail?I think we don't need to check each step's return value. And if we fail to write
a file, bash helps to output error message to break golden image too.Thanks,
ZorroQuoted 134 lines
tests/xfs/554 new file +24
-0+ +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1$SCRATCH_MNT/$testfolder2/$file1
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1$SCRATCH_MNT/$testfolder1/$file1_ln
+_verify_parent "$testfolder1" "$file1_ln"
"$testfolder1/$file1_ln"tests/xfs/554 new file +2
-0+_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1""$testfolder1/$file1_ln"
tests/xfs/554 new file +7
-0+_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln""$testfolder1/$file1_ln"
tests/xfs/554 new file +6
-0+_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +9
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exittests/xfs/554.out new file +59
-0@@ -0,0 +1,59 @@ +QA output created by 554 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2Signature · 1 line
2.25.1
Re: [PATCH v2 2/4] xfs: add parent pointer test
Quoted 98 lines · Allison Henderson
Quoted 76 lines · Zorro Lang
Quoted 51 lines · Zorro Lang
Quoted 50 lines · Catherine Hoang
From: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link,
unlink, rename, overwrite).Signed-off-by Allison Henderson <[email protected]>Signed-off-by Catherine Hoang <[email protected]>---
doc/group-names.txt | 1 +
tests/xfs/554 | 125
++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/554.out | 59 +++++++++++++++++++++3 files changed, 185 insertions(+)create mode 100755 tests/xfs/554
create mode 100644 tests/xfs/554.outdoc/group-names.txt +0
-0@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access controllists
nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group
+parent Parent pointer tests
pattern specific IO pattern tests perms access control and permission checking pipe pipe functionalitytests/xfs/554 new file +3
-0@@ -0,0 +1,125 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All RightsReserved.
tests/xfs/554 new file +9
-0+# +# FS QA Test 554 +# +# simple parent pointer test +# + +. ./common/preamble +_begin_fstest auto quick parent +Quoted 8 lines
tests/xfs/554 line 17
Quoted 5 lines
tests/xfs/554 new file +5
-0+cleanup() +{ + cd / + rm -f $tmp.* +}This's same with common cleanup function, you can remove this function.
Same for patch 3 and 4.
Quoted 12 lines
tests/xfs/554 line 24
Quoted 8 lines
tests/xfs/554 new file +7
-0+ +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +}What's this function for? I didn't see this function is called in this case.
Am I missing something?Quoted 1 line
Same question for patch 3 and 4.
Think I answered these in the other patch review...
Quoted 18 lines
Quoted 14 lines
Quoted 4 lines
tests/xfs/554 new file +2
-0+ +# get standard environment, filters and checkstests/xfs/554 line 36
Quoted 10 lines
tests/xfs/554 new file +10
-0+. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp"And does this case really do error injection? I didn't find that. If not, please
remove this requirement and above common/inject.
Quoted 3 lines
I think at one point I had all these tests in one file and then later separated them into multiple tests. So I think the requirements for injects can be removed from patch 2 and 3
Sure, yes, same for patch 3 not 4. I said wrong below:)
Quoted 189 lines
Quoted 2 lines
Same question for patch 4.
Patch 4 does do injects, so the requirement should stay.
Allison
Quoted 182 lines
Thanks,
ZorroQuoted 177 lines
Quoted 20 lines
tests/xfs/554 new file +20
-0+_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the roottests/xfs/554 line 66
Quoted 10 lines
tests/xfs/554 new file +10
-0+testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fiIt just writes a general file, right? Is there any special reason might cause
write fail?I think we don't need to check each step's return value. And if we fail to write
a file, bash helps to output error message to break golden image too.Thanks,
ZorroQuoted 134 lines
tests/xfs/554 new file +24
-0+ +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1$SCRATCH_MNT/$testfolder2/$file1
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1$SCRATCH_MNT/$testfolder1/$file1_ln
+_verify_parent "$testfolder1" "$file1_ln"
"$testfolder1/$file1_ln"tests/xfs/554 new file +2
-0+_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1""$testfolder1/$file1_ln"
tests/xfs/554 new file +7
-0+_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln""$testfolder1/$file1_ln"
tests/xfs/554 new file +6
-0+_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +9
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exittests/xfs/554.out new file +59
-0@@ -0,0 +1,59 @@ +QA output created by 554 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2Signature · 1 line
2.25.1
Re: [PATCH v2 2/4] xfs: add parent pointer test
In reply to Zorro LangQuoted 50 lines · Zorro Lang
Quoted 49 lines · Catherine Hoang
From: Allison Henderson <[email protected]>
Add a test to verify basic parent pointers operations (create, move, link,
unlink, rename, overwrite).Signed-off-by Allison Henderson <[email protected]>Signed-off-by Catherine Hoang <[email protected]>---
doc/group-names.txt | 1 +
tests/xfs/554 | 125
++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/554.out | 59 +++++++++++++++++++++3 files changed, 185 insertions(+)create mode 100755 tests/xfs/554
create mode 100644 tests/xfs/554.outdoc/group-names.txt +0
-0@@ -77,6 +77,7 @@ nfs4_acl NFSv4 access control listsnonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group
+parent Parent pointer tests
pattern specific IO pattern tests perms access control and permission checking pipe pipe functionalitytests/xfs/554 new file +3
-0@@ -0,0 +1,125 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All RightsReserved.
tests/xfs/554 new file +9
-0+# +# FS QA Test 554 +# +# simple parent pointer test +# + +. ./common/preamble +_begin_fstest auto quick parent +
Quoted 8 lines
tests/xfs/554 line 17
Quoted 5 lines
tests/xfs/554 new file +5
-0+cleanup() +{ + cd / + rm -f $tmp.* +}This's same with common cleanup function, you can remove this function.
Ok, these tests were initially written before these helpers were hoisted into a common location, so it makes sense to clean them out now.
Quoted 12 lines
tests/xfs/554 line 24
Quoted 8 lines
tests/xfs/554 new file +7
-0+ +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +}What's this function for? I didn't see this function is called in this case.
Am I missing something?
I think it's another common helper that's over in common/log now. I suspect it was just reminiscent of the test case I modeled this after at the time. It should likely come out now too.
Quoted 48 lines
Quoted 33 lines
tests/xfs/554 new file +32
-0+ +# get standard environment, filters and checks +. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp" +_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the roottests/xfs/554 line 66
Quoted 10 lines
tests/xfs/554 new file +10
-0+testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fiIt just writes a general file, right? Is there any special reason might cause
write fail?
Quoted 4 lines
I think we don't need to check each step's return value. And if we fail to write
a file, bash helps to output error message to break golden image too.
I think I had borrowed this from the protofile test case (tests/xfs/019). But yes, if the file creation were to fail, I think the mkfs command will just error out. It should be fine to take it out if folks prefer. Thanks for the reviews!
Allison
Quoted 135 lines
Thanks,
ZorroQuoted 131 lines
tests/xfs/554 new file +24
-0+ +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1$SCRATCH_MNT/$testfolder2/$file1
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1$SCRATCH_MNT/$testfolder1/$file1_ln
tests/xfs/554 new file +16
-0+_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1" "$testfolder1/$file1_ln" +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +9
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3$SCRATCH_MNT/$testfolder1/$file2
tests/xfs/554 new file +5
-0+_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exittests/xfs/554.out new file +59
-0@@ -0,0 +1,59 @@ +QA output created by 554 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2Signature · 1 line
2.25.1
PATCH v2 3/4 xfs: add multi link parent pointer test
In reply to Catherine HoangFrom: Allison Henderson <[email protected]>
Add a test to verify parent pointers while multiple links to a file are created and removed.
--- tests/xfs/555 | 96 +++++ tests/xfs/555.out | 1002 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1098 insertions(+) create mode 100755 tests/xfs/555 create mode 100644 tests/xfs/555.out
tests/xfs/555 new file +96 -0
@@ -0,0 +1,96 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 555 +# +# multi link parent pointer test +# +. ./common/preamble +_begin_fstest auto quick parent + +cleanup() +{ + cd / + rm -f $tmp.* +} + +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +} + +# get standard environment, filters and checks +. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_io_error_injection "larp" +_require_xfs_sysfs debug/larp +_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fi + +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqresres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" +# Multi link parent pointer test +NLINKS=100 +for (( j=0; j<$NLINKS; j++ )); do + ln $SCRATCH_MNT/$testfolder1/$file1 $SCRATCH_MNT/$testfolder1/$file1_ln.$j + _verify_parent "$testfolder1" "$file1_ln.$j" "$testfolder1/$file1" + _verify_parent "$testfolder1" "$file1" "$testfolder1/$file1_ln.$j" +done +# Multi unlink parent pointer test +for (( j=$NLINKS-1; j<=0; j-- )); do + ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln.$j)" + rm $SCRATCH_MNT/$testfolder1/$file1_ln.$j + _verify_no_parent "$file1_ln.$j" "$ino" "$testfolder1/$file1" +done + +# success, all done +status=0 +exit
tests/xfs/555.out new file +1002 -0
1,002 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/4 xfs: add parent pointer inject test
In reply to Catherine HoangFrom: Allison Henderson <[email protected]>
Add a test to verify parent pointers after an error injection and log replay.
--- tests/xfs/556 | 110 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/556.out | 14 ++++++ 2 files changed, 124 insertions(+) create mode 100755 tests/xfs/556 create mode 100644 tests/xfs/556.out
tests/xfs/556 new file +110 -0
@@ -0,0 +1,110 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 556 +# +# parent pointer inject test +# +. ./common/preamble +_begin_fstest auto quick parent + +cleanup() +{ + cd / + rm -f $tmp.* +} + +full() +{ + echo "" >>$seqres.full + echo "*** $* ***" >>$seqres.full + echo "" >>$seqres.full +} + +# get standard environment, filters and checks +. ./common/filter +. ./common/reflink +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp" +_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <<EOF +DUMMY1 +0 0 +: root directory +d--777 3 1 +: a directory +testfolder1 d--755 3 1 +file1 ---755 3 1 /dev/null +$ +: back in the root +testfolder2 d--755 3 1 +file2 ---755 3 1 /dev/null +: done +$ +EOF + +if [ $? -ne 0 ] +then + _fail "failed to create test protofile" +fi + +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file1="file1" +file2="file2" +file3="file3" +file4="file4" +file5="file5" +file1_ln="file1_link" + +echo "" + +# Create files +touch $SCRATCH_MNT/$testfolder1/$file4 +_verify_parent "$testfolder1" "$file4" "$testfolder1/$file4" + +# Inject error +_scratch_inject_error "larp" + +# Move files +mv $SCRATCH_MNT/$testfolder1/$file4 $SCRATCH_MNT/$testfolder2/$file5 2>&1 \ + | _filter_scratch + +# FS should be shut down, touch will fail +touch $SCRATCH_MNT/$testfolder2/$file5 2>&1 | _filter_scratch + +# Remount to replay log +_scratch_remount_dump_log >> $seqres.full + +# FS should be online, touch should succeed +touch $SCRATCH_MNT/$testfolder2/$file5 + +# Check files again +_verify_parent "$testfolder2" "$file5" "$testfolder2/$file5" + +# success, all done +status=0 +exit
tests/xfs/556.out new file +14 -0
@@ -0,0 +1,14 @@ +QA output created by 556 + +*** testfolder1 OK +*** testfolder1/file4 OK +*** testfolder1/file4 OK +*** Verified parent pointer: name:file4, namelen:5 +*** Parent pointer OK for child testfolder1/file4 +mv: cannot stat 'SCRATCH_MNT/testfolder1/file4': Input/output error +touch: cannot touch 'SCRATCH_MNT/testfolder2/file5': Input/output error +*** testfolder2 OK +*** testfolder2/file5 OK +*** testfolder2/file5 OK +*** Verified parent pointer: name:file5, namelen:5 +*** Parent pointer OK for child testfolder2/file5
Signature · 1 line
2.25.1