From: Catherine Hoang <catherine.hoang@oracle.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v2 4/4] xfs: add parent pointer inject test
Date: Tue, 11 Oct 2022 18:38:12 -0700 [thread overview]
Message-ID: <20221012013812.82161-5-catherine.hoang@oracle.com> (raw)
In-Reply-To: <20221012013812.82161-1-catherine.hoang@oracle.com>
From: Allison Henderson <allison.henderson@oracle.com>
Add a test to verify parent pointers after an error injection and log
replay.
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
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
diff --git a/tests/xfs/556 b/tests/xfs/556
new file mode 100755
index 00000000..47e55bd7
--- /dev/null
+++ b/tests/xfs/556
@@ -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
diff --git a/tests/xfs/556.out b/tests/xfs/556.out
new file mode 100644
index 00000000..812330ee
--- /dev/null
+++ b/tests/xfs/556.out
@@ -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
--
2.25.1
prev parent reply other threads:[~2022-10-12 1:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 1:38 [PATCH v2 0/4] xfstests: add parent pointer tests Catherine Hoang
2022-10-12 1:38 ` [PATCH v2 1/4] common: add helpers for " Catherine Hoang
2022-10-12 1:38 ` [PATCH v2 2/4] xfs: add parent pointer test Catherine Hoang
2022-10-12 3:02 ` Zorro Lang
2022-10-12 3:10 ` Zorro Lang
2022-10-13 19:55 ` Allison Henderson
2022-10-14 1:24 ` Zorro Lang
2022-10-13 19:07 ` Allison Henderson
2022-10-12 1:38 ` [PATCH v2 3/4] xfs: add multi link " Catherine Hoang
2022-10-12 1:38 ` Catherine Hoang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221012013812.82161-5-catherine.hoang@oracle.com \
--to=catherine.hoang@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).