All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: fstests@vger.kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH] xfs/141: use new errortag knob for crc error injection
Date: Wed, 28 Jun 2017 07:44:50 -0400	[thread overview]
Message-ID: <20170628114450.9670-1-bfoster@redhat.com> (raw)

Update the test to use the newly available sysfs errortag injection
knobs. The errortag knob has replaced the previous custom knob in
the kernel. Create a local helper to support the old knob for
backwards compatibility.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---

This updates xfs/141 to use the new error injection tag sysfs knob that
has replaced log_badcrc_factor in the latest XFS for-next tree.

Brian

 tests/xfs/141 | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/xfs/141 b/tests/xfs/141
index 56ff14e..ea4f558 100755
--- a/tests/xfs/141
+++ b/tests/xfs/141
@@ -43,6 +43,21 @@ _cleanup()
 	wait > /dev/null 2>&1
 }
 
+# require either the current error tag or the old custom log record crc error
+# injection knob
+_setup_bad_crc()
+{
+	if [ -e /sys/fs/xfs/$1/errortag/log_bad_crc ]; then
+		badcrc_attr=/sys/fs/xfs/$1/errortag/log_bad_crc
+		return
+	fi
+	if [ -e /sys/fs/xfs/$1/log/log_badcrc_factor ]; then
+		badcrc_attr=/sys/fs/xfs/$1/log/log_badcrc_factor
+		return
+	fi
+	_notrun "bad crc sysfs attribute not supported"
+}
+
 rm -f $seqres.full
 
 # get standard environment, filters and checks
@@ -53,7 +68,6 @@ rm -f $seqres.full
 # Modify as appropriate.
 _supported_fs xfs
 _supported_os Linux
-_require_xfs_sysfs $(_short_dev $TEST_DEV)/log/log_badcrc_factor
 _require_scratch
 _require_command "$KILLALL_PROG" killall
 
@@ -62,14 +76,14 @@ echo "Silence is golden."
 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 _scratch_mount
 
-sdev=$(_short_dev $SCRATCH_DEV)
+_setup_bad_crc $(_short_dev $SCRATCH_DEV)
 
 for i in $(seq 1 5); do
 	# Enable error injection. Use a random bad crc factor up to 100
 	# (increase this value to run fsstress longer).
 	factor=$((RANDOM % 100 + 1))
-	echo iteration $i log_badcrc_factor: $factor >> $seqres.full 2>&1
-	echo $factor > /sys/fs/xfs/$sdev/log/log_badcrc_factor
+	echo iteration $i bad crc factor: $factor >> $seqres.full 2>&1
+	echo $factor > $badcrc_attr
 
 	# Run fsstress until the filesystem shuts down. It will shut down
 	# automatically when error injection triggers.
-- 
2.9.4


             reply	other threads:[~2017-06-28 11:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 11:44 Brian Foster [this message]
2017-06-29  4:40 ` [PATCH] xfs/141: use new errortag knob for crc error injection Darrick J. Wong
2017-06-29 11:54   ` Brian Foster
2017-06-29 15:22     ` Darrick J. Wong

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=20170628114450.9670-1-bfoster@redhat.com \
    --to=bfoster@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.