Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26700C0044C for ; Wed, 31 Oct 2018 09:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE142205F4 for ; Wed, 31 Oct 2018 09:51:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE142205F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-btrfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728007AbeJaStH (ORCPT ); Wed, 31 Oct 2018 14:49:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:44294 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727527AbeJaStH (ORCPT ); Wed, 31 Oct 2018 14:49:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 23C1FAF94; Wed, 31 Oct 2018 09:51:41 +0000 (UTC) Subject: Re: [PATCH v3] fstests: btrfs/057: Fix false alerts due to orphan files To: Qu Wenruo , Qu Wenruo , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org References: <20181030101819.19510-1-wqu@suse.com> <96e63270-1697-479a-b2b0-f6b2e78ede90@suse.com> From: Nikolay Borisov Openpgp: preference=signencrypt Autocrypt: addr=nborisov@suse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fez+JbAGl6iCvHYt/wAZ7Oqe/3Cirs5 KhaXBcMmJR1qo8QH8eYZ+qhFE3bSPH446+5oEw8A9v5oonKV7zMAEQEAAcLBXwQYAQIACQUC WIoHPgIbDAAKCRBxvoJG5T8oV1pyD/4zdXdOL0lhkSIjJWGqz7Idvo0wjVHSSQCbOwZDWNTN JBTP0BUxHpPu/Z8gRNNP9/k6i63T4eL1xjy4umTwJaej1X15H8Hsh+zakADyWHadbjcUXCkg OJK4NsfqhMuaIYIHbToi9K5pAKnV953xTrK6oYVyd/Rmkmb+wgsbYQJ0Ur1Ficwhp6qU1CaJ mJwFjaWaVgUERoxcejL4ruds66LM9Z1Qqgoer62ZneID6ovmzpCWbi2sfbz98+kW46aA/w8r 7sulgs1KXWhBSv5aWqKU8C4twKjlV2XsztUUsyrjHFj91j31pnHRklBgXHTD/pSRsN0UvM26 lPs0g3ryVlG5wiZ9+JbI3sKMfbdfdOeLxtL25ujs443rw1s/PVghphoeadVAKMPINeRCgoJH zZV/2Z/myWPRWWl/79amy/9MfxffZqO9rfugRBORY0ywPHLDdo9Kmzoxoxp9w3uTrTLZaT9M KIuxEcV8wcVjr+Wr9zRl06waOCkgrQbTPp631hToxo+4rA1jiQF2M80HAet65ytBVR2pFGZF zGYYLqiG+mpUZ+FPjxk9kpkRYz61mTLSY7tuFljExfJWMGfgSg1OxfLV631jV1TcdUnx+h3l Sqs2vMhAVt14zT8mpIuu2VNxcontxgVr1kzYA/tQg32fVRbGr449j1gw57BV9i0vww== Message-ID: Date: Wed, 31 Oct 2018 11:51:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 31.10.18 г. 11:22 ч., Qu Wenruo wrote: > > > On 2018/10/31 下午4:55, Nikolay Borisov wrote: >> >> >> On 30.10.18 г. 12:18 ч., Qu Wenruo wrote: >>> For any recent 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. >> >> Something's fishy about this test! THe description states that " >> Quota rescan stress test, we run fsstress and quota rescan >> concurrently" yet fsstress is not run concurrently to quota. We first >> run fsstress, then trigger rescan with -w. How exactly are rescan and >> fsstress run concurrently ? > > Indeed that description is just garbage. > > The real objective looks like just fsstress + rescan test. > No concurrency at all from the very beginning. > > Not sure what to do with it. I guess the real question here is whether the test as-is tests for anything useful - if not, we have to either: a) Rewrite it so that it is useful. From the original commit log: Test flow is to run fsstress after triggering quota rescan. the ruler is simple, we just remove all files and directories, sync filesystem and see if qgroup's ref and excl are nodesize. b) Delete it I can see how a concurrent write to the fs and a pending rescan could be a useful thing to exercise. Perhaps it's just a question of making fsstress run in the background with slightly bigger workload (and do away with the awful (and deprecated) style of stream redirection '>&/dev/null'). From bash's man page: There are two formats for redirecting standard output and standard error: &>word and >&word Of the two forms, the first is preferred. > > Thanks, > Qu > >> >>> >>> Reported-by: Nikolay Borisov >>> Signed-off-by: Qu Wenruo >>> Reviewed-by: Filipe Manana >>> --- >>> Changelog: >>> v2: >>> Update commit message to show this is a long existing bug. >>> v3: >>> Remove an old comment since now we don't need to specify the leaf >>> size. >>> Added Reviewed-by tags. >>> --- >>> tests/btrfs/057 | 18 ++++-------------- >>> tests/btrfs/057.out | 3 +-- >>> 2 files changed, 5 insertions(+), 16 deletions(-) >>> >>> diff --git a/tests/btrfs/057 b/tests/btrfs/057 >>> index b019f4e1e054..82e3162ebfeb 100755 >>> --- a/tests/btrfs/057 >>> +++ b/tests/btrfs/057 >>> @@ -32,13 +32,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 +49,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 60cb92d0926c..185023c79961 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 >>> >