From patchwork Thu Apr 23 23:31:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11506863 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0870B1392 for ; Thu, 23 Apr 2020 23:34:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD43920784 for ; Thu, 23 Apr 2020 23:34:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="AosyFxsP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728169AbgDWXeB (ORCPT ); Thu, 23 Apr 2020 19:34:01 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:59902 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbgDWXeA (ORCPT ); Thu, 23 Apr 2020 19:34:00 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNX2T8143431; Thu, 23 Apr 2020 23:33:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=i1VBjbzyACnS7ie40jsO9uUgfVwFWq5OInGK1HzgCnI=; b=AosyFxsPUYwaFzr8r0jDMuJdyOqai2bPNSIC9/St6Q4eL0yLQ2XnnYGevXlKiMRuiqfz QMN89uEajRqd2lh0MQRIn+eR9k7PSsLshWwXOadqMhK1hv36ak6xhpEuMvfSqUjeTjIC GW1QNYmVv/Vjyxk1NipeckjlmtJ1AyA5iHoqfNqPg7IPFYzkdZsTaIwqRx7jhbIePdTf GzcR1rPFDa5EGUEfO26AahmYHfyfzVde2rv/B0OvsqX+5Bz9DTxwsliviFDPQ6Zre1PA F5areFmyYuam88nN1soKzrJVSrPUDZa1/wyHvsI0JyFDVlGm/5zk31aUu3K+c+CljSaB XQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 30ketdhm9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:33:58 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNReMw160665; Thu, 23 Apr 2020 23:31:58 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 30k7qw2ch0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:31:58 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03NNVv3D021521; Thu, 23 Apr 2020 23:31:57 GMT Received: from localhost (/10.159.232.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Apr 2020 16:31:57 -0700 Subject: [PATCH 1/4] xfs: test that reflink forces the log if mounted with wsync From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Thu, 23 Apr 2020 16:31:53 -0700 Message-ID: <158768471382.3019475.14095534927414395012.stgit@magnolia> In-Reply-To: <158768470761.3019475.18353274420657119359.stgit@magnolia> References: <158768470761.3019475.18353274420657119359.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230168 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong A code inspection revealed that reflink does not force the log to disk even if the filesystem is mounted with wsync. Add a regression test for commit 5833112df7e9a ("xfs: reflink should force the log out if mounted with wsync"). Signed-off-by: Darrick J. Wong --- tests/xfs/914 | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/914.out | 7 ++++++ tests/xfs/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/xfs/914 create mode 100644 tests/xfs/914.out diff --git a/tests/xfs/914 b/tests/xfs/914 new file mode 100755 index 00000000..b835394a --- /dev/null +++ b/tests/xfs/914 @@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 914 +# +# Make sure that reflink forces the log out if we mount with wsync. We test +# that it actually forced the log by immediately shutting down the fs without +# flushing the log and then remounting to check file contents. + +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.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_scratch_mount -o wsync >> $seqres.full + +# Set up initial files +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full +$XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full +_cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e +_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d +touch $SCRATCH_MNT/b +sync + +# Test that setting the reflink flag on the dest file forces the log +echo "test reflink flag not set" +$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/b >> $seqres.full +_scratch_cycle_mount wsync +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch + +# Test forcing the log even if both files are already reflinked +echo "test reflink flag already set" +$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/d >> $seqres.full +_scratch_cycle_mount wsync +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/d | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/xfs/914.out b/tests/xfs/914.out new file mode 100644 index 00000000..6b19fc65 --- /dev/null +++ b/tests/xfs/914.out @@ -0,0 +1,7 @@ +QA output created by 914 +test reflink flag not set +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/b +test reflink flag already set +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/d diff --git a/tests/xfs/group b/tests/xfs/group index 12eb55c9..d39daf00 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -513,3 +513,4 @@ 513 auto mount 514 auto quick db 515 auto quick quota +914 auto quick reflink From patchwork Thu Apr 23 23:32:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11506853 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4068D1392 for ; Thu, 23 Apr 2020 23:32:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26DE120736 for ; Thu, 23 Apr 2020 23:32:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lNCz9QCV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbgDWXcG (ORCPT ); Thu, 23 Apr 2020 19:32:06 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:44298 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgDWXcG (ORCPT ); Thu, 23 Apr 2020 19:32:06 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNSX7g110736; Thu, 23 Apr 2020 23:32:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=mCARlnDWl2MkvgEJ0RrRVAwzMNudjqv78FadlNPlLFg=; b=lNCz9QCVHyJpFT0tWSYf7fcWEhhUw9/QDxM39xm8Er4me/V76mMzaFrItKT9TPEXl5hc kpEzrahEhkPJrnC2fNHb+SiyuUFzA0CiMVxYGqXa8JBUTUbzFLpehDc6tzJWGsq4LB8K gTsFk6h6K5gCtPpDfcBR3Wq5ymZ89kn8GA9HJKtfdbjQB7nuupS61y2iAqViae8berVy NhsRjO2JGl3bcPNa8KFJFOFygD63AVWNXuopqqOU37fCD9T0+X1lz1IvuyX8QGrwojyT 4k52MXP3Q5dsBbwxQvt+ytROY9OmKdByuqsPbOhUjdj4u3ZFbFTB3jr9Sh5jIxQtnNYl bg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 30jvq4xbqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:32:04 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNViC3163984; Thu, 23 Apr 2020 23:32:04 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 30gb3westy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:32:04 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03NNW436003426; Thu, 23 Apr 2020 23:32:04 GMT Received: from localhost (/10.159.232.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Apr 2020 16:32:03 -0700 Subject: [PATCH 2/4] xfs: race freeze and fsmap for a while to see if we livelock From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Thu, 23 Apr 2020 16:32:02 -0700 Message-ID: <158768472236.3019475.7921951820050889421.stgit@magnolia> In-Reply-To: <158768470761.3019475.18353274420657119359.stgit@magnolia> References: <158768470761.3019475.18353274420657119359.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 clxscore=1015 bulkscore=0 spamscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230168 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Run fsfreeze and fsmap against each other in a loop to see if we observe any livelocks, crashes, or odd slowness from either operation. This is a regression test for 27fb5a72f50aa77 ("xfs: prohibit fs freezing when using empty transactions"). Signed-off-by: Darrick J. Wong --- tests/xfs/755 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/755.out | 4 ++ tests/xfs/group | 1 3 files changed, 113 insertions(+) create mode 100755 tests/xfs/755 create mode 100644 tests/xfs/755.out diff --git a/tests/xfs/755 b/tests/xfs/755 new file mode 100755 index 00000000..56ad3485 --- /dev/null +++ b/tests/xfs/755 @@ -0,0 +1,108 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 755 +# +# Race freeze and fsmap for a while to see if we crash or livelock. +# +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 7 15 + +_cleanup() +{ + cd / + $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT > /dev/null 2>&1 + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_xfs_scratch_rmapbt +_require_xfs_io_command "fsmap" +_require_command "$KILLALL_PROG" killall + +echo "Format and populate" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +STRESS_DIR="$SCRATCH_MNT/testdir" +mkdir -p $STRESS_DIR + +for i in $(seq 0 9); do + mkdir -p $STRESS_DIR/$i + for j in $(seq 0 9); do + mkdir -p $STRESS_DIR/$i/$j + for k in $(seq 0 9); do + echo x > $STRESS_DIR/$i/$j/$k + done + done +done + +cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR)) + +echo "Concurrent fsmap and freeze" +filter_output() { + egrep -v '(Device or resource busy|Invalid argument)' +} +freeze_loop() { + end="$1" + + while [ "$(date +%s)" -lt $end ]; do + $XFS_IO_PROG -x -c 'freeze' $SCRATCH_MNT 2>&1 | filter_output + $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output + done +} +fsmap_loop() { + end="$1" + + while [ "$(date +%s)" -lt $end ]; do + $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > /dev/null + done +} +stress_loop() { + end="$1" + + FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID) + while [ "$(date +%s)" -lt $end ]; do + $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full + done +} + +start=$(date +%s) +end=$((start + (30 * TIME_FACTOR) )) + +echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full +stress_loop $end & +freeze_loop $end & +fsmap_loop $end & + +# Wait until 2 seconds after the loops should have finished... +while [ "$(date +%s)" -lt $((end + 2)) ]; do + sleep 1 +done + +# ...and clean up after the loops in case they didn't do it themselves. +$KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1 +$XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1 + +echo "Loop finished at $(date)" >> $seqres.full +echo "Test done" + +# success, all done +status=0 +exit diff --git a/tests/xfs/755.out b/tests/xfs/755.out new file mode 100644 index 00000000..cf681c86 --- /dev/null +++ b/tests/xfs/755.out @@ -0,0 +1,4 @@ +QA output created by 755 +Format and populate +Concurrent fsmap and freeze +Test done diff --git a/tests/xfs/group b/tests/xfs/group index d39daf00..b0e4816f 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -513,4 +513,5 @@ 513 auto mount 514 auto quick db 515 auto quick quota +755 auto quick fsmap freeze 914 auto quick reflink From patchwork Thu Apr 23 23:32:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11506873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 746FB1392 for ; Thu, 23 Apr 2020 23:34:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CBB12087E for ; Thu, 23 Apr 2020 23:34:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="I/B/ukl8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727979AbgDWXe1 (ORCPT ); Thu, 23 Apr 2020 19:34:27 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60134 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727902AbgDWXe0 (ORCPT ); Thu, 23 Apr 2020 19:34:26 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNWwSx143404; Thu, 23 Apr 2020 23:34:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=2New5V5MvHezX9t1CQMJzqVfFPrbzmyCnQW8iwQXsRg=; b=I/B/ukl8FwKOL5BlsbtcBELviTuTBBSOeukSrlXnEmodTw/ijxntNs8pxb9Frn8XEZQT ELs/QJ1Vjr1cDXpzAYmcjcREHt1aguDB6DLNDpztnKzT41fqSszim55sMFaQELXJSxEU hUu72JD9dXToFjnBQxbN4nnV0ivUh3/WLdIdU+SJcR3r36FGDfjymj/878kyULJDVLKm UxaeZVYo9tt9hSFvO2ClVtrkEsO2+f9DU4uXRzpkrZ6zR4ce4GwkEijqcLY6gvJTKJ/5 DHmfrPBleNSgT7cio2W5o+GYzMU/RwvV/dIq4LYsGKEu72FlhQYBn1i1UG5KrpH10lgE FA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 30ketdhmaj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:34:24 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNWOZL043483; Thu, 23 Apr 2020 23:32:24 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 30gb1nmsrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:32:23 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03NNWArq032559; Thu, 23 Apr 2020 23:32:10 GMT Received: from localhost (/10.159.232.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Apr 2020 16:32:10 -0700 Subject: [PATCH 3/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Thu, 23 Apr 2020 16:32:08 -0700 Message-ID: <158768472874.3019475.13731875015196637937.stgit@magnolia> In-Reply-To: <158768470761.3019475.18353274420657119359.stgit@magnolia> References: <158768470761.3019475.18353274420657119359.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck. This is a regression test for 5885539f0af371 ("xfs: preserve default grace interval during quotacheck"). Signed-off-by: Darrick J. Wong --- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.out diff --git a/tests/xfs/913 b/tests/xfs/913 new file mode 100755 index 00000000..94681b02 --- /dev/null +++ b/tests/xfs/913 @@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1 + +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# success, all done +status=0 +exit diff --git a/tests/xfs/913.out b/tests/xfs/913.out new file mode 100644 index 00000000..ee989388 --- /dev/null +++ b/tests/xfs/913.out @@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] diff --git a/tests/xfs/group b/tests/xfs/group index b0e4816f..a626b786 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -514,4 +514,5 @@ 514 auto quick db 515 auto quick quota 755 auto quick fsmap freeze +913 auto quick quota 914 auto quick reflink From patchwork Thu Apr 23 23:32:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11506871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2211F17EA for ; Thu, 23 Apr 2020 23:34:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05B612064A for ; Thu, 23 Apr 2020 23:34:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="NkAO33eg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728181AbgDWXeW (ORCPT ); Thu, 23 Apr 2020 19:34:22 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60088 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbgDWXeV (ORCPT ); Thu, 23 Apr 2020 19:34:21 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNXeZG143829; Thu, 23 Apr 2020 23:34:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=J6VDgDEms5P9mFwi25Zml/+fS4n2dc9TPGM6ZIyXYC4=; b=NkAO33egZBoc/0Bd4Dnp2ZNmC/uQlHuP46v9d7dForfxkOa/fPTdOLzahirxr6G1VpTY s6xEbWhQJY4cOePXosOCsBZa3RRN8452HdD2DVR8WNkka1uFK2pxKBqx4nQIyLy4F7Bp 74H5W9v/E8XsLxg173nUuL23jOg9adYf0OypFoxlgYDlQgSrxTbnQ0dM5hcJhf2xGEkD RC1kulhmoP1co+OxpEIKJBnESNQVlAmMGEUE+YHNGQdkdsrmqNCyBILi+5Z31FYArUyH UBBwH/IWaufF5LqbdwZyM2IpH+VV3QwlVEVgJA59UZeca8jV4JRi5x2TQ3t5D+t1MUZe pQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 30ketdhmaf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:34:18 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03NNVjQL164129; Thu, 23 Apr 2020 23:32:18 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 30gb3wet0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2020 23:32:17 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03NNWGcu032568; Thu, 23 Apr 2020 23:32:16 GMT Received: from localhost (/10.159.232.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Apr 2020 16:32:16 -0700 Subject: [PATCH 4/4] xfs: test sunit/swidth updates From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Thu, 23 Apr 2020 16:32:15 -0700 Message-ID: <158768473510.3019475.13810129822322030743.stgit@magnolia> In-Reply-To: <158768470761.3019475.18353274420657119359.stgit@magnolia> References: <158768470761.3019475.18353274420657119359.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9600 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004230169 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Add one test to make sure that we can update sunit without blowing up the filesystem. This is a regression test for 13eaec4b2adf ("xfs: don't commit sunit/swidth updates to disk if that would cause repair failures"). Signed-off-by: Darrick J. Wong --- tests/xfs/751 | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/751.out | 9 +++ tests/xfs/group | 1 3 files changed, 191 insertions(+) create mode 100755 tests/xfs/751 create mode 100644 tests/xfs/751.out diff --git a/tests/xfs/751 b/tests/xfs/751 new file mode 100755 index 00000000..c586342f --- /dev/null +++ b/tests/xfs/751 @@ -0,0 +1,181 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 751 +# +# Update sunit and width and make sure that the filesystem still passes +# xfs_repair afterwards. + +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 / +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_scratch_nocheck + +# Assume that if we can run scrub on the test dev we can run it on the scratch +# fs too. +run_scrub=0 +_supports_xfs_scrub $TEST_DIR $TEST_DEV && run_scrub=1 + +log() +{ + echo "$@" | tee -a $seqres.full /dev/ttyprintk +} + +__test_mount_opts() +{ + local mounted=0 + + # Try to mount the fs with our test options. + _try_scratch_mount "$@" >> $seqres.full 2>&1 && mounted=1 + if [ $mounted -gt 0 ]; then + # Implant a sentinel file to see if repair nukes the directory + # later. Scrub, unmount, and check for errors. + echo moo > $SCRATCH_MNT/a + grep "$SCRATCH_MNT" /proc/mounts >> $seqres.full + test $run_scrub -gt 0 && \ + _scratch_scrub -n >> $seqres.full + _scratch_unmount + _scratch_xfs_repair -n >> $seqres.full 2>&1 || \ + echo "Repair found problems." + else + echo "mount failed" >> $seqres.full + fi + _scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full + + # Run xfs_repair in repair mode to see if it can be baited into nuking + # the root filesystem on account of the sunit update. + _scratch_xfs_repair >> $seqres.full 2>&1 + + # If the previous mount succeeded, mount the fs and look for the file + # we implanted. + if [ $mounted -gt 0 ]; then + _scratch_mount + test -f $SCRATCH_MNT/a || echo "Root directory got nuked." + _scratch_unmount + fi + + echo >> $seqres.full +} + +test_sunit_opts() +{ + echo "Format with 4k stripe unit; 1x stripe width" >> $seqres.full + _scratch_mkfs -b size=4k -d sunit=8,swidth=8 >> $seqres.full 2>&1 + + __test_mount_opts "$@" +} + +test_su_opts() +{ + local mounted=0 + + echo "Format with 256k stripe unit; 4x stripe width" >> $seqres.full + _scratch_mkfs -b size=1k -d su=256k,sw=4 >> $seqres.full 2>&1 + + __test_mount_opts "$@" +} + +test_repair_detection() +{ + local mounted=0 + + echo "Format with 256k stripe unit; 4x stripe width" >> $seqres.full + _scratch_mkfs -b size=1k -d su=256k,sw=4 >> $seqres.full 2>&1 + + # Try to mount the fs with our test options. + _try_scratch_mount >> $seqres.full 2>&1 && mounted=1 + if [ $mounted -gt 0 ]; then + # Implant a sentinel file to see if repair nukes the directory + # later. Scrub, unmount, and check for errors. + echo moo > $SCRATCH_MNT/a + grep "$SCRATCH_MNT" /proc/mounts >> $seqres.full + test $run_scrub -gt 0 && \ + _scratch_scrub -n >> $seqres.full + _scratch_unmount + _scratch_xfs_repair -n >> $seqres.full 2>&1 || \ + echo "Repair found problems." + else + echo "mount failed" >> $seqres.full + fi + + # Update the superblock like the kernel used to do. + _scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full + _scratch_xfs_db -x -c 'sb 0' -c 'write -d unit 256' -c 'write -d width 1024' >> $seqres.full + _scratch_xfs_db -c 'sb 0' -c 'p unit width' >> $seqres.full + + # Run xfs_repair in repair mode to see if it can be baited into nuking + # the root filesystem on account of the sunit update. + _scratch_xfs_repair >> $seqres.full 2>&1 + + # If the previous mount succeeded, mount the fs and look for the file + # we implanted. + if [ $mounted -gt 0 ]; then + _scratch_mount + test -f $SCRATCH_MNT/a || echo "Root directory got nuked." + _scratch_unmount + fi + + echo >> $seqres.full +} + +# Format with a 256k stripe unit and 4x stripe width, and try various mount +# options that want to change that and see if they blow up. Normally you +# would never change the stripe *unit*, so it's no wonder this is not well +# tested. + +log "Test: no raid parameters" +test_su_opts + +log "Test: 256k stripe unit; 4x stripe width" +test_su_opts -o sunit=512,swidth=2048 + +log "Test: 256k stripe unit; 5x stripe width" +test_su_opts -o sunit=512,swidth=2560 + +# Note: Larger stripe units probably won't mount +log "Test: 512k stripe unit; 4x stripe width" +test_su_opts -o sunit=1024,swidth=4096 + +log "Test: 512k stripe unit; 3x stripe width" +test_su_opts -o sunit=1024,swidth=3072 + +# Note: Should succeed with kernel warnings, and should not create repair +# failures or nuke the root directory. +log "Test: 128k stripe unit; 8x stripe width" +test_su_opts -o sunit=256,swidth=2048 + +# Note: Should succeed without nuking the root dir +log "Test: Repair of 128k stripe unit; 8x stripe width" +test_repair_detection + +# Brian Foster noticed a bug in an earlier version of the patch that avoids +# updating the ondisk sunit/swidth values if they would cause later repair +# failures. The bug was that we wouldn't convert the kernel mount option sunit +# value to the correct incore units until after computing the inode geometry. +# This caused it to behave incorrectly when the filesystem was formatted with +# sunit=1fsb and the mount options try to increase swidth. +log "Test: Formatting with sunit=1fsb,swidth=1fsb and mounting with larger swidth" +test_sunit_opts -o sunit=8,swidth=64 + +# success, all done +status=0 +exit diff --git a/tests/xfs/751.out b/tests/xfs/751.out new file mode 100644 index 00000000..451c07be --- /dev/null +++ b/tests/xfs/751.out @@ -0,0 +1,9 @@ +QA output created by 751 +Test: no raid parameters +Test: 256k stripe unit; 4x stripe width +Test: 256k stripe unit; 5x stripe width +Test: 512k stripe unit; 4x stripe width +Test: 512k stripe unit; 3x stripe width +Test: 128k stripe unit; 8x stripe width +Test: Repair of 128k stripe unit; 8x stripe width +Test: Formatting with sunit=1fsb,swidth=1fsb and mounting with larger swidth diff --git a/tests/xfs/group b/tests/xfs/group index a626b786..bb77e94b 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -513,6 +513,7 @@ 513 auto mount 514 auto quick db 515 auto quick quota +751 auto quick 755 auto quick fsmap freeze 913 auto quick quota 914 auto quick reflink