From patchwork Mon Oct 29 06:35:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10658793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9C5B13BF for ; Mon, 29 Oct 2018 06:35:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDD4A295D7 for ; Mon, 29 Oct 2018 06:35:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1420296DD; Mon, 29 Oct 2018 06:35:09 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 6D85D295D7 for ; Mon, 29 Oct 2018 06:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729275AbeJ2PWZ (ORCPT ); Mon, 29 Oct 2018 11:22:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:32768 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729225AbeJ2PWY (ORCPT ); Mon, 29 Oct 2018 11:22:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9F591AC8C; Mon, 29 Oct 2018 06:35:07 +0000 (UTC) From: Qu Wenruo To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH] fstests: btrfs/057: Fix false alerts due to orphan files Date: Mon, 29 Oct 2018 14:35:01 +0800 Message-Id: <20181029063501.21604-1-wqu@suse.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For latest kernel, there is a chance that btrfs/057 reports false errors. The false error would look like: btrfs/057 4s ... - output mismatch (see /home/adam/xfstests-dev/results//btrfs/057.out.bad) --- tests/btrfs/057.out 2017-08-21 09:25:33.166666666 +0800 +++ /home/adam/xfstests-dev/results//btrfs/057.out.bad 2018-10-29 14:07:28.443651293 +0800 @@ -1,3 +1,3 @@ QA output created by 057 4096 4096 -4096 4096 +28672 28672 This is related to the fact that "btrfs subvolume sync" (or vanilla sync) will not ensure orphan (unlinked but still exist) files to be removed. In fact, for that false error case, if inspecting the fs after umount, its qgroup number is correct and btrfs check won't report qgroup error. To fix the false alerts, just skip any manual qgroup number comparison, and let fsck done after the test case to detect problem. This also elimiate the necessary of using specified mount and mkfs option, allowing us to improve coverage. Reported-by: Nikolay Borisov Signed-off-by: Qu Wenruo Reviewed-by: Filipe Manana --- tests/btrfs/057 | 17 ++++------------- tests/btrfs/057.out | 3 +-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/btrfs/057 b/tests/btrfs/057 index b019f4e1..0b5a36d3 100755 --- a/tests/btrfs/057 +++ b/tests/btrfs/057 @@ -33,12 +33,9 @@ _require_scratch rm -f $seqres.full # use small leaf size to get higher btree height. -run_check _scratch_mkfs "-b 1g --nodesize 4096" +run_check _scratch_mkfs "-b 1g" -# inode cache is saved in the FS tree itself for every -# individual FS tree,that affects the sizes reported by qgroup show -# so we need to explicitly turn it off to get consistent values. -_scratch_mount "-o noinode_cache" +_scratch_mount # -w ensures that the only ops are ones which cause write I/O run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 \ @@ -53,14 +50,8 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 \ _run_btrfs_util_prog quota enable $SCRATCH_MNT _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT -# remove all file/dir other than subvolume -rm -rf $SCRATCH_MNT/snap1/* >& /dev/null -rm -rf $SCRATCH_MNT/p* >& /dev/null - -_run_btrfs_util_prog filesystem sync $SCRATCH_MNT -units=`_btrfs_qgroup_units` -$BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' \ - | $AWK_PROG '{print $2" "$3}' +echo "Silence is golden" +# btrfs check will detect any qgroup number mismatch. status=0 exit diff --git a/tests/btrfs/057.out b/tests/btrfs/057.out index 60cb92d0..185023c7 100644 --- a/tests/btrfs/057.out +++ b/tests/btrfs/057.out @@ -1,3 +1,2 @@ QA output created by 057 -4096 4096 -4096 4096 +Silence is golden