linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catherine Hoang <catherine.hoang@oracle.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v2 1/1] xfstests: Add Log Attribute Replay test
Date: Wed,  1 Sep 2021 22:10:06 +0000	[thread overview]
Message-ID: <20210901221006.125888-2-catherine.hoang@oracle.com> (raw)
In-Reply-To: <20210901221006.125888-1-catherine.hoang@oracle.com>

From: Allison Henderson <allison.henderson@oracle.com>

This patch adds a test to exercise the log attribute error
inject and log replay.  Attributes are added in increaseing
sizes up to 64k, and the error inject is used to replay them
from the log

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
V2: Updated attr sizes
   Added attr16k test
   Removed rm -f $seqres.full
   Added filtering for SCRATCH_MNT
---
 tests/xfs/540     | 101 ++++++++++++++++++++++++++++
 tests/xfs/540.out | 168 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 269 insertions(+)
 create mode 100755 tests/xfs/540
 create mode 100755 tests/xfs/540.out

diff --git a/tests/xfs/540 b/tests/xfs/540
new file mode 100755
index 00000000..b2fdc153
--- /dev/null
+++ b/tests/xfs/540
@@ -0,0 +1,101 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 2>&1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"
+	touch $testfile.1 2>&1 | _filter_scratch
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch
+	$ATTR_PROG -g $attr_name $testfile.1 | md5sum
+
+	echo ""
+}
+
+
+# real QA test starts here
+_supported_fs xfs
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEF"
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k"
+attr16k="$attr8k$attr8k"
+attr32k="$attr16k$attr16k"
+attr64k="$attr32k$attr32k"
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr16k
+_test_attr_replay "attr_name8" $attr32k
+_test_attr_replay "attr_name9" $attr64k
+
+
+echo "*** done"
+status=0
+exit
diff --git a/tests/xfs/540.out b/tests/xfs/540.out
new file mode 100755
index 00000000..e5f39ccf
--- /dev/null
+++ b/tests/xfs/540.out
@@ -0,0 +1,168 @@
+QA output created by 540
+*** mkfs
+*** mount FS
+*** make test file 1
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name1" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+
+5a5e91e29ed5e8aa7a30547754b9e1ee  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name2" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+
+1d61ccb38292dc01ebe9ea93bbd2564f  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name3" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+
+f513471cb87436a3df3fb930d5babb9f  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name4" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+
+0bc08fada39bf76dc83c856ee2a7d7d5  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name5" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+
+258b2457eed1ce94e61168c734948198  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name6" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+
+507b6ac60f89d347160ddc1be73193ad  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name7" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+
+a856751ea45e3c121b7b4f1fa423defc  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name8" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+
+150bffbd81292b5f239923f6a54c0c1a  -
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name9" for SCRATCH_MNT/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+user.attr_name9
+
+29133253befceb131c3b736f2687cff9  -
+
+*** done
+*** unmount
-- 
2.25.1


  reply	other threads:[~2021-09-01 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 22:10 [PATCH v2 0/1] Log Attribute Replay Test Catherine Hoang
2021-09-01 22:10 ` Catherine Hoang [this message]
2021-09-01 23:36   ` [PATCH v2 1/1] xfstests: Add Log Attribute Replay test Dave Chinner
2021-09-02  8:58     ` Allison Henderson

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=20210901221006.125888-2-catherine.hoang@oracle.com \
    --to=catherine.hoang@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --subject='Re: [PATCH v2 1/1] xfstests: Add Log Attribute Replay test' \
    /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

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).