From patchwork Mon Sep 18 08:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gu Jinxiang X-Patchwork-Id: 9955673 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 D06E960385 for ; Mon, 18 Sep 2017 08:11:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C166828B8F for ; Mon, 18 Sep 2017 08:11:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B62FB28BC0; Mon, 18 Sep 2017 08:11:39 +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=unavailable 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 6C19828B8F for ; Mon, 18 Sep 2017 08:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbdIRILf (ORCPT ); Mon, 18 Sep 2017 04:11:35 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:50372 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752125AbdIRILd (ORCPT ); Mon, 18 Sep 2017 04:11:33 -0400 X-IronPort-AV: E=Sophos;i="5.42,411,1500912000"; d="scan'208";a="26735157" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Sep 2017 16:11:30 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id A39A647ACDA1; Mon, 18 Sep 2017 16:11:30 +0800 (CST) Received: from localhost.localdomain (10.167.226.132) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 18 Sep 2017 16:11:33 +0800 From: Gu Jinxiang To: CC: Subject: [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Date: Mon, 18 Sep 2017 16:11:09 +0800 Message-ID: <1505722270-24648-1-git-send-email-gujx@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.167.226.132] X-yoursite-MailScanner-ID: A39A647ACDA1.A7906 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: gujx@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Resovle the inconsistent of mount option. Btrfs use MOUNT_OPTIONS for both scrath_dev and test_dev. Change to MOUNT_OPTIONS for scratch mount, and TEST_FS_MOUNT_OPTS for test dev mount. Signed-off-by: Gu Jinxiang --- As mentioned by https://patchwork.kernel.org/patch/9742039/, the usage of MOUNT_OPTIONS is inconsistent. common/btrfs | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/rc | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/common/btrfs b/common/btrfs index fd762ef..2a1cfaf 100644 --- a/common/btrfs +++ b/common/btrfs @@ -89,6 +89,62 @@ _require_btrfs_fs_feature() _notrun "Feature $feat not supported by the available btrfs version" } +_check_test_btrfs_filesystem() +{ + device=$1 + + # If type is set, we're mounted + type=`_fs_type $device` + ok=1 + + if [ "$type" = "$FSTYP" ]; then + # mounted ... + mountpoint=`_umount_or_remount_ro $device` + fi + + if [ -f ${RESULT_DIR}/require_scratch.require_qgroup_report ]; then + $BTRFS_UTIL_PROG check $device --qgroup-report > $tmp.qgroup_report 2>&1 + if grep -qE "Counts for qgroup.*are different" $tmp.qgroup_report ; then + _log_err "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers" + echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full + cat $tmp.qgroup_report >>$seqres.full + echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full + fi + rm -f $tmp.qgroup_report + fi + + $BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1 + if [ $? -ne 0 ]; then + _log_err "_check_btrfs_filesystem: filesystem on $device is inconsistent" + echo "*** fsck.$FSTYP output ***" >>$seqres.full + cat $tmp.fsck >>$seqres.full + echo "*** end fsck.$FSTYP output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fsck + + if [ $ok -eq 0 ]; then + echo "*** mount output ***" >>$seqres.full + _mount >>$seqres.full + echo "*** end mount output" >>$seqres.full + elif [ "$type" = "$FSTYP" ]; then + # was mounted ... + _mount_or_remount_rw "$TEST_FS_MOUNT_OPTS" $device $mountpoint + ok=$? + fi + + if [ $ok -eq 0 ]; then + status=1 + if [ "$iam" != "check" ]; then + exit 1 + fi + return 1 + fi + + return 0 +} + _check_btrfs_filesystem() { device=$1 diff --git a/common/rc b/common/rc index cd53a37..eb9c469 100644 --- a/common/rc +++ b/common/rc @@ -2624,7 +2624,7 @@ _check_test_fs() # do nothing for now ;; btrfs) - _check_btrfs_filesystem $TEST_DEV + _check_test_btrfs_filesystem $TEST_DEV ;; tmpfs) # no way to check consistency for tmpfs