From patchwork Fri Aug 19 17:56:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 9290743 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 62235607FF for ; Fri, 19 Aug 2016 17:56:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 580F0294AC for ; Fri, 19 Aug 2016 17:56:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D10929535; Fri, 19 Aug 2016 17:56:40 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BACEC294AC for ; Fri, 19 Aug 2016 17:56:39 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 0DD487CA3; Fri, 19 Aug 2016 12:56:39 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 86B467CA2 for ; Fri, 19 Aug 2016 12:56:37 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay1.corp.sgi.com (Postfix) with ESMTP id 4B7558F8037 for ; Fri, 19 Aug 2016 10:56:37 -0700 (PDT) X-ASG-Debug-ID: 1471629395-0bf57c55b269420001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id gDtw0CHDt6uDfns4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 19 Aug 2016 10:56:36 -0700 (PDT) X-Barracuda-Envelope-From: zlang@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 716BE80F7B; Fri, 19 Aug 2016 17:56:35 +0000 (UTC) Received: from localhost (vpn1-4-252.pek2.redhat.com [10.72.4.252]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7JHuYpX006388; Fri, 19 Aug 2016 13:56:34 -0400 From: Zorro Lang To: fstests@vger.kernel.org Subject: [PATCH 1/2] xfs/006: move code about resetting error handling to common/rc Date: Sat, 20 Aug 2016 01:56:31 +0800 X-ASG-Orig-Subj: [PATCH 1/2] xfs/006: move code about resetting error handling to common/rc Message-Id: <1471629392-13661-1-git-send-email-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 19 Aug 2016 17:56:35 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1471629395 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 4173 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 Cc: Zorro Lang , xfs@oss.sgi.com X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP Nearly 1/3 code is used to reset the xfs error handling attributes, This part can be picked up, and used for other cases. So move them to a new function reset_xfs_sysfs_error_handling() in common/rc. Signed-off-by: Zorro Lang --- common/rc | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/006 | 27 +++++++-------------------- tests/xfs/006.out | 1 + 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/common/rc b/common/rc index 3fb0600..b038d8e 100644 --- a/common/rc +++ b/common/rc @@ -3888,6 +3888,43 @@ _get_fs_sysfs_attr() cat /sys/fs/${FSTYP}/${dname}/${attr} } + +# Reset all xfs error handling attributes, set them to original +# status. +# +# Only one argument, and it's necessary: +# - dev: device name, e.g. $SCRATCH_DEV +# +# Note: this function only works for XFS +reset_xfs_sysfs_error_handling() +{ + local dev=$1 + + if [ ! -b "$dev" -o "$FSTYP" != "xfs" ];then + _fail "Usage: reset_xfs_sysfs_error_handling " + fi + + _set_fs_sysfs_attr $dev error/fail_at_unmount 1 + echo -n "error/fail_at_unmount=" + _get_fs_sysfs_attr $dev error/fail_at_unmount + + # Make sure all will be configured to retry forever by default, except + # for ENODEV, which is an unrecoverable error, so it will be configured + # to not retry on error by default. + for e in default EIO ENOSPC; do + _set_fs_sysfs_attr $dev \ + error/metadata/${e}/max_retries -1 + echo -n "error/metadata/${e}/max_retries=" + _get_fs_sysfs_attr $dev error/metadata/${e}/max_retries + + _set_fs_sysfs_attr $dev \ + error/metadata/${e}/retry_timeout_seconds 0 + echo -n "error/metadata/${e}/retry_timeout_seconds=" + _get_fs_sysfs_attr $dev \ + error/metadata/${e}/retry_timeout_seconds + done +} + # Skip if we are running an older binary without the stricter input checks. # Make multiple checks to be sure that there is no regression on the one # selected feature check, which would skew the result. diff --git a/tests/xfs/006 b/tests/xfs/006 index 8910026..58f9348 100755 --- a/tests/xfs/006 +++ b/tests/xfs/006 @@ -57,31 +57,18 @@ _scratch_mkfs > $seqres.full 2>&1 _dmerror_init _dmerror_mount -# Enable fail_at_unmount, so XFS stops retrying on errors at unmount -# time. _fail the test if we fail to set it to 1, because the test -# probably will hang in such case and block subsequent tests. -_set_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount 1 +# Make sure all error handling attributes are original status +reset_xfs_sysfs_error_handling $DMERROR_DEV + +# Make sure fail_at_unmount is enabled, so XFS stops retrying on +# errors at unmount time. _fail the test if we fail to set it to 1, +# because the test probably will hang in such case and block +# subsequent tests. attr=`_get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount` if [ "$attr" != "1" ]; then _fail "Failed to set error/fail_at_unmount: $attr" fi -# Make sure all will be configured to retry forever by default, except -# for ENODEV, which is an unrecoverable error, so it will be configured -# to not retry on error by default. -for e in default EIO ENOSPC; do - _set_fs_sysfs_attr $DMERROR_DEV \ - error/metadata/${e}/max_retries -1 - echo -n "error/metadata/${e}/max_retries=" - _get_fs_sysfs_attr $DMERROR_DEV error/metadata/${e}/max_retries - - _set_fs_sysfs_attr $DMERROR_DEV \ - error/metadata/${e}/retry_timeout_seconds 0 - echo -n "error/metadata/${e}/retry_timeout_seconds=" - _get_fs_sysfs_attr $DMERROR_DEV \ - error/metadata/${e}/retry_timeout_seconds -done - # start a metadata-intensive workload, but no data allocation operation. # Because uncompleted new space allocation I/Os may cause XFS to shutdown # after loading error table. diff --git a/tests/xfs/006.out b/tests/xfs/006.out index 393f411..3260b3a 100644 --- a/tests/xfs/006.out +++ b/tests/xfs/006.out @@ -1,4 +1,5 @@ QA output created by 006 +error/fail_at_unmount=1 error/metadata/default/max_retries=-1 error/metadata/default/retry_timeout_seconds=0 error/metadata/EIO/max_retries=-1