From patchwork Wed Jan 3 19:26:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10142891 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 036BD60594 for ; Wed, 3 Jan 2018 19:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E66E329068 for ; Wed, 3 Jan 2018 19:26:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAD30290EF; Wed, 3 Jan 2018 19:26:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 682DF29068 for ; Wed, 3 Jan 2018 19:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbeACT0b (ORCPT ); Wed, 3 Jan 2018 14:26:31 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:58652 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbeACT0a (ORCPT ); Wed, 3 Jan 2018 14:26:30 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id w03JNk3u092564; Wed, 3 Jan 2018 19:26:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=WfHiScJo7AsWsq1GifqXHcpXDkQxlAjtcA7T493HWo8=; b=LNTRWAfxjVUIIDHkMiSXeOb3CwyWXnQNOusfh3nK5ZzAEqNb75kp0X2vsEqEJWa8mfmT x9WMh/2F/rlV/+JKTp8RAOu0jSxhTJO8+cMAA2oOzckEuyWvO2U0PSj/lvdVheJ8nf5z m3R/z7CZHpoOJobutSbHHP42MUn36Xr9GDPV0qPx0JuVB0j2rrrOVfjPL5jECvANPbYZ MQ2SM25HuSZi4SsOFBfu00i7qoCGaMS1g21tlw86vzSjvKQSYqz37Dpw4qn8kNrjGRgf sKDLgvrS5NWjrIowORx7Zd7FZXpK4Em2YaAzMsmZAOV5cZtVpQJszqtSpvGexzRDOCuZ aw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2f951d82hp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Jan 2018 19:26:28 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w03JQRkJ029517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Jan 2018 19:26:27 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w03JQRPU009272; Wed, 3 Jan 2018 19:26:27 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 03 Jan 2018 11:26:27 -0800 Date: Wed, 3 Jan 2018 11:26:26 -0800 From: "Darrick J. Wong" To: eguan@redhat.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 10/8] xfs: check that fs freeze minimizes required recovery Message-ID: <20180103192626.GB4854@magnolia> References: <151314499003.18893.8687182548758898133.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <151314499003.18893.8687182548758898133.stgit@magnolia> User-Agent: Mutt/1.5.24 (2015-08-30) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8763 signatures=668651 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=800 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801030264 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Make sure that a fs freeze operation cleans up as much of the filesystem so as to minimize the recovery required in a crash/remount scenario. In particular we want to check that we don't leave CoW preallocations sitting around in the refcountbt, though this test looks for anything out of the ordinary on the frozen fs. Signed-off-by: Darrick J. Wong --- tests/xfs/903 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/903.out | 10 +++++ tests/xfs/group | 1 3 files changed, 118 insertions(+) create mode 100755 tests/xfs/903 create mode 100644 tests/xfs/903.out -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/xfs/903 b/tests/xfs/903 new file mode 100755 index 0000000..1686356 --- /dev/null +++ b/tests/xfs/903 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. 903 +# +# Test that frozen filesystems are relatively clean and not full of errors. +# Prior to freezing a filesystem, we want to minimize the amount of recovery +# that will have to happen if the system goes down while the fs is frozen. +# Therefore, start up fsstress and cycle through a few freeze/thaw cycles +# to ensure that nothing blows up when we try to do this. +# +# Unfortunately the log will probably still be dirty, so we can't do much +# about enforcing a clean repair -n run. +# +#----------------------------------------------------------------------- +# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. +# Copyright (c) 2018 Oracle. 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 +trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + # Make sure we thaw the fs before we unmount or else we remove the + # mount without actually deactivating the filesystem(!) + $XFS_IO_PROG -x -c "thaw" $SCRATCH_MNT 2> /dev/null + echo "*** unmount" + _scratch_unmount 2>/dev/null +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux + +_require_scratch + +# xfs_db will OOM kill the machine if you don't have huge amounts of RAM, so +# don't run this on large filesystems. +_require_no_large_scratch_dev + +echo "*** init FS" + +rm -f $seqres.full +_scratch_unmount >/dev/null 2>&1 +echo "*** MKFS ***" >>$seqres.full +echo "" >>$seqres.full +_scratch_mkfs_xfs >>$seqres.full 2>&1 || _fail "mkfs failed" +_scratch_mount >>$seqres.full 2>&1 || _fail "mount failed" + +echo "*** test" + +for l in 0 1 2 3 4 +do + echo " *** test $l" + FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -n 1000 $FSSTRESS_AVOID` + $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full + + $XFS_IO_PROG -x -c 'freeze' $SCRATCH_MNT + + # Log will probably be dirty after the freeze, record state + echo "" >>$seqres.full + echo "*** xfs_logprint ***" >>$seqres.full + echo "" >>$seqres.full + log=clean + _scratch_xfs_logprint -tb 2>&1 | tee -a $seqres.full \ + | head | grep -q "" || log=dirty + + # Fail if repair complains and the log is clean + echo "" >>$seqres.full + echo "*** XFS_REPAIR -n ***" >>$seqres.full + echo "" >>$seqres.full + _scratch_xfs_repair -f -n >> $seqres.full 2>&1 + + if [ $? -ne 0 ] && [ "$log" = "clean" ]; then + _fail "xfs_repair failed" + fi + + $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT +done + +echo "*** done" +status=0 +exit 0 diff --git a/tests/xfs/903.out b/tests/xfs/903.out new file mode 100644 index 0000000..378f0cb --- /dev/null +++ b/tests/xfs/903.out @@ -0,0 +1,10 @@ +QA output created by 903 +*** init FS +*** test + *** test 0 + *** test 1 + *** test 2 + *** test 3 + *** test 4 +*** done +*** unmount diff --git a/tests/xfs/group b/tests/xfs/group index e1b1582..23c26c2 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -435,3 +435,4 @@ 435 auto quick clone 436 auto quick clone fsr 708 auto quick other +903 mount auto quick stress