From patchwork Wed Sep 23 07:19:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7248021 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37DDBBEEC1 for ; Wed, 23 Sep 2015 07:20:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FDD52034B for ; Wed, 23 Sep 2015 07:20:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A21C2035E for ; Wed, 23 Sep 2015 07:20:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635AbbIWHUt (ORCPT ); Wed, 23 Sep 2015 03:20:49 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:27885 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752150AbbIWHUr (ORCPT ); Wed, 23 Sep 2015 03:20:47 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="101010647" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 23 Sep 2015 15:23:31 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t8N7KSsp027990 for ; Wed, 23 Sep 2015 15:20:28 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Wed, 23 Sep 2015 15:20:46 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH v2 3/3] btrfs-progs: tests: Introduce misc-tests/008-leaf-across-stripes Date: Wed, 23 Sep 2015 15:19:06 +0800 Message-ID: <2b9521b025a849e20411d5390d176bd3664291bf.1442992715.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To check is btrfs-convert create bad filesystem with leaf across stripes. It is happened in progs version <=v4.1.2, and fixed by patch titled: btrfs: convert: Avoid allocating metadata extent crossing stripe boundary which was merged in v4.2. Notice thar this testcase can not report error in old version of btrfs-progs, because "btrfs check" can't check this type of error in those version, but we have another testcase in fsck-tests, to check is "btrfs check" support this check. So, use above 2 testcase together can check out leaf-across-stripes bug in all version. Signed-off-by: Zhao Lei --- tests/misc-tests/008-leaf-across-stripes/test.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tests/misc-tests/008-leaf-across-stripes/test.sh diff --git a/tests/misc-tests/008-leaf-across-stripes/test.sh b/tests/misc-tests/008-leaf-across-stripes/test.sh new file mode 100755 index 0000000..cd426a9 --- /dev/null +++ b/tests/misc-tests/008-leaf-across-stripes/test.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# test btrfs-convert create filesystem without leaf across stripes + +source $TOP/tests/common + +check_prereq btrfs-convert +check_prereq btrfs + +# In my test, it happened in 514M~560M, 737M~769M, 929M~917M, +# and HAVE_ERROR=((size + 1) / 2) % 2 if size >= 970 +# +SIZE_FROM=514 +SIZE_END=560 +A_PRIME_NUM=17 +for ((size = SIZE_FROM; size <= SIZE_END; size += A_PRIME_NUM)); do + run_check truncate -s "$size"M "$IMAGE" + run_check mkfs.ext4 -F "$IMAGE" + run_check $TOP/btrfs-convert "$IMAGE" + $TOP/btrfs check "$IMAGE" 2>&1 | grep "crossing stripe boundary" && + _fail "leaf across stripes in btrfs-convert" +done + +exit 0