On Thu, 2022-11-03 at 11:32 +0800, Zorro Lang wrote: > On Wed, Nov 02, 2022 at 11:11:30PM +0000, Catherine Hoang wrote: > > > On Oct 31, 2022, at 11:23 PM, Zorro Lang <zlang@xxxxxxxxxx> > > > wrote: > > > > > > On Fri, Oct 28, 2022 at 02:56:03PM -0700, Catherine Hoang wrote: > > > > From: Allison Henderson <allison.henderson@xxxxxxxxxx> > > > > > > > > Add a test to verify basic parent pointers operations (create, > > > > move, link, > > > > unlink, rename, overwrite). > > > > > > > > Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx> > > > > Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx> > > > > --- > > > > doc/group-names.txt | 1 + > > > > tests/xfs/554 | 101 > > > > ++++++++++++++++++++++++++++++++++++++++++++ > > > > tests/xfs/554.out | 59 ++++++++++++++++++++++++++ > > > > 3 files changed, 161 insertions(+) > > > > create mode 100755 tests/xfs/554 > > > > create mode 100644 tests/xfs/554.out > > > > > > > > diff --git a/doc/group-names.txt b/doc/group-names.txt > > > > index ef411b5e..8e35c699 100644 > > > > --- a/doc/group-names.txt > > > > +++ b/doc/group-names.txt > > > > @@ -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 > > > > diff --git a/tests/xfs/554 b/tests/xfs/554 > > > > > > Hi, > > > > > > xfs/554 has been taken, please rebase to the lastest for-next > > > branch, or you > > > can a big enough number (e.g. 999) to avoid merging conflict, > > > then I can rename > > > the name after merging. > > > > Ah ok, I didn’t see that when I was sending out these tests. I’ll > > rebase this to the > > latest for-next branch > > > > > > > new file mode 100755 > > > > index 00000000..44b77f9d > > > > --- /dev/null > > > > +++ b/tests/xfs/554 > > > > @@ -0,0 +1,101 @@ > > > > +#! /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 > > > > + > > > > +# get standard environment, filters and checks > > > > +. ./common/parent > > > > + > > > > +# Modify as appropriate > > > > +_supported_fs xfs > > > > +_require_scratch > > > > +_require_xfs_sysfs debug/larp > > > > > > Is debug/larp needed by this case? > > > > I believe the parent pointer code now turns on larp mode > > automatically, > > so it’s probably ok to remove this line since we aren’t explicitly > > turning > > it on in the tests anymore. > > Sorry I'm confused about this explanation:) Do you need to read/write > the > /sys/fs/xfs/debug/larp in this case? No, you only have to do that if you want ALL attributes to be logged. If the fs was created with the parent mkfs option, then parent pointer attributes (at least) will be logged. Unlike normal attrs, parent pointers cannot be toggled. So once they are enabled at mkfs time, they will always be logged regardless as to whether the standard attributes are being logged or not. > To make sure *parent* feature is 100% > truned on? Can't _require_xfs_parent make sure current system support > the > parent feature ? Yes, basically the _require_xfs_parent routine ensures the the parent mkfs option is there and works :-) > > > > > > > > +_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 > > > > + > > > > +_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" > > > > > > _scratch_mount calls _fail() inside. > > > > Ok, will remove this _fail call. Thanks! > > > > > > Thanks, > > > Zorro > > > > > > > + > > > > +testfolder1="testfolder1" > > > > +testfolder2="testfolder2" > > > > +file1="file1" > > > > +file2="file2" > > > > +file3="file3" > > > > +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 > > > > +exit > > > > diff --git a/tests/xfs/554.out b/tests/xfs/554.out > > > > new file mode 100644 > > > > index 00000000..67ea9f2b > > > > --- /dev/null > > > > +++ b/tests/xfs/554.out > > > > @@ -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/file2 > > > > -- > > > > 2.25.1 > > > > > > > > > >