From patchwork Wed Jun 28 11:44:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 9814019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1CA4560365 for ; Wed, 28 Jun 2017 11:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FCB8284E3 for ; Wed, 28 Jun 2017 11:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02B8828510; Wed, 28 Jun 2017 11:44:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86873284E3 for ; Wed, 28 Jun 2017 11:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751596AbdF1Low (ORCPT ); Wed, 28 Jun 2017 07:44:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52704 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbdF1Low (ORCPT ); Wed, 28 Jun 2017 07:44:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3D5D8553E; Wed, 28 Jun 2017 11:44:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D3D5D8553E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bfoster@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D3D5D8553E Received: from bfoster.bfoster (dhcp-41-20.bos.redhat.com [10.18.41.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5B615C3FB; Wed, 28 Jun 2017 11:44:51 +0000 (UTC) Received: by bfoster.bfoster (Postfix, from userid 1000) id B2829120043; Wed, 28 Jun 2017 07:44:50 -0400 (EDT) From: Brian Foster 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 Message-Id: <20170628114450.9670-1-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 28 Jun 2017 11:44:52 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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.