From patchwork Wed Sep 14 02:52:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 9330255 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 5495060231 for ; Wed, 14 Sep 2016 02:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49AA829863 for ; Wed, 14 Sep 2016 02:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E05729866; Wed, 14 Sep 2016 02:58:20 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C1D0629863 for ; Wed, 14 Sep 2016 02:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751518AbcINC6T (ORCPT ); Tue, 13 Sep 2016 22:58:19 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:19881 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751091AbcINC6S (ORCPT ); Tue, 13 Sep 2016 22:58:18 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="10957747" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Sep 2016 10:58:17 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 717E34623464; Wed, 14 Sep 2016 10:58:13 +0800 (CST) Received: from localhost.localdomain (10.167.220.69) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.279.2; Wed, 14 Sep 2016 10:58:12 +0800 From: Xiao Yang To: CC: , , , Xiao Yang Subject: [PATCH v4] xfs/098: fix xfs_repair on newer xfsprogs Date: Wed, 14 Sep 2016 10:52:36 +0800 Message-ID: <1473821556-27889-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20160913070804.GF12847@dhcp12-143.nay.redhat.com> References: <20160913070804.GF12847@dhcp12-143.nay.redhat.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.69] X-yoursite-MailScanner-ID: 717E34623464.A80D0 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 1) use _repair_scratch_fs instead of xfs_repair The obsolete xfs_repair always cleared the log regardless of whether it is corrupted and current xfs_repair only cleared the log when -L option is specified. xfs_repair -L option should be used to clear it if xfs_repair failed to clear log. 2) catch non-zero return value instead of 2 It can be applied to both the old return value 1 and the new return value 2 3) add filter_xfs_dmesg to ignore mount related warnings If we corrupt log and mount on a CONFIG_XFS_WARN build, there will be mount related warnings in dmesg as expected. Signed-off-by: Xiao Yang --- common/rc | 2 +- tests/xfs/098 | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 13afc6a..655ae28 100644 --- a/common/rc +++ b/common/rc @@ -1152,7 +1152,7 @@ _repair_scratch_fs() xfs) _scratch_xfs_repair "$@" 2>&1 res=$? - if [ "$res" -eq 2 ]; then + if [ "$res" -ne 0 ]; then echo "xfs_repair returns $res; replay log?" _scratch_mount res=$? diff --git a/tests/xfs/098 b/tests/xfs/098 index d91d617..86ec62c 100755 --- a/tests/xfs/098 +++ b/tests/xfs/098 @@ -54,6 +54,17 @@ _require_xfs_db_blocktrash_z_command test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3" rm -f $seqres.full + +# If we corrupt log on a CONFIG_XFS_WARN build, there will be mount related +# WARNINGs in dmesg as expected. We don't want to simply _disable_dmesg_check +# which could miss other potential bugs, so filter out the intentional WARNINGs, +# make sure test doesn't fail because of this warning and fails on other WARNINGs. +filter_xfs_dmesg() +{ + local warn="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*" + sed -e "s#$warn#Intentional warnings in asswarn#" +} + TESTDIR="${SCRATCH_MNT}/scratchdir" TESTFILE="${TESTDIR}/testfile" @@ -93,7 +104,10 @@ echo "+ mount image" _scratch_mount 2>/dev/null && _fail "mount should not succeed" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 + +# mount may trigger related WARNINGs, so filter them. +_check_dmesg filter_xfs_dmesg echo "+ mount image (2)" _scratch_mount