From patchwork Mon Jul 17 18:53:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill O'Donnell X-Patchwork-Id: 9845945 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 BB89160386 for ; Mon, 17 Jul 2017 18:54:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B02DC22376 for ; Mon, 17 Jul 2017 18:54:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4D702851E; Mon, 17 Jul 2017 18:54:02 +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 2DAFA22376 for ; Mon, 17 Jul 2017 18:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334AbdGQSyB (ORCPT ); Mon, 17 Jul 2017 14:54:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311AbdGQSyA (ORCPT ); Mon, 17 Jul 2017 14:54:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AAD58C0587E2 for ; Mon, 17 Jul 2017 18:54:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAD58C0587E2 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=billodo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AAD58C0587E2 Received: from localhost.localdomain.com (ovpn-120-87.rdu2.redhat.com [10.10.120.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 607CA5D6A2 for ; Mon, 17 Jul 2017 18:54:00 +0000 (UTC) From: Bill O'Donnell To: fstests@vger.kernel.org Subject: [PATCH v3] xfs/424: test xfs_db to ensure type size taken into account with new type Date: Mon, 17 Jul 2017 13:53:59 -0500 Message-Id: <20170717185359.18958-1-billodo@redhat.com> In-Reply-To: <20170712183112.5255-1-billodo@redhat.com> References: <20170712183112.5255-1-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Jul 2017 18:54:00 +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 xfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error. Signed-off-by: Bill O'Donnell --- v2: Clarify commit message and test comments. Add a few more test cases. v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to accomodate fses with external logs. Remove superfluous daddr and type commands. tests/xfs/424 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out diff --git a/tests/xfs/424 b/tests/xfs/424 new file mode 100755 index 00000000..8415ecd1 --- /dev/null +++ b/tests/xfs/424 @@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + for TYPE in inodata data log text rtbitmap rtsummary; do + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" +done + +# success, all done +status=0 +exit diff --git a/tests/xfs/424.out b/tests/xfs/424.out new file mode 100644 index 00000000..d879a949 --- /dev/null +++ b/tests/xfs/424.out @@ -0,0 +1 @@ +QA output created by 424 diff --git a/tests/xfs/group b/tests/xfs/group index ffdb0615..75c8280c 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db