From patchwork Wed Sep 14 02:49:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 9330253 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 B489660231 for ; Wed, 14 Sep 2016 02:54:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03592985E for ; Wed, 14 Sep 2016 02:54:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 948AE29861; Wed, 14 Sep 2016 02:54:55 +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 EF7E42985E for ; Wed, 14 Sep 2016 02:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753522AbcINCyy (ORCPT ); Tue, 13 Sep 2016 22:54:54 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:59897 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752439AbcINCyx (ORCPT ); Tue, 13 Sep 2016 22:54:53 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="10957592" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Sep 2016 10:54:51 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 199EC4623464; Wed, 14 Sep 2016 10:54:48 +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:54:46 +0800 From: Xiao Yang To: <--in-reply-to=20160913070804.GF12847@dhcp12-143.nay.redhat.com>, CC: , , , Xiao Yang Subject: [PATCH v4] xfs/098: fix xfs_repair on newer xfsprogs Date: Wed, 14 Sep 2016 10:49:11 +0800 Message-ID: <1473821351-27820-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.69] X-yoursite-MailScanner-ID: 199EC4623464.A7B67 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 Reviewed-by: Zorro Lang --- 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