From patchwork Fri Sep 4 13:23:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7122711 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 A84CCBF036 for ; Fri, 4 Sep 2015 13:27:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B508620840 for ; Fri, 4 Sep 2015 13:27:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9177C20896 for ; Fri, 4 Sep 2015 13:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933096AbbIDNZk (ORCPT ); Fri, 4 Sep 2015 09:25:40 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:63975 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S933129AbbIDNZh (ORCPT ); Fri, 4 Sep 2015 09:25:37 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100347638" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Sep 2015 21:28: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 t84DPJqv030002 for ; Fri, 4 Sep 2015 21:25:19 +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; Fri, 4 Sep 2015 21:25:29 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 3/3] btrfs-progs: tests: Introduce misc-tests/008-leaf-accross-stripes Date: Fri, 4 Sep 2015 21:23:51 +0800 Message-ID: <87244a2006270f7f8a32680ce8ba7656e277a4bd.1441373012.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <154afcdd14c259551d843a157814fd0ff3589e8f.1441373012.git.zhaolei@cn.fujitsu.com> References: <154afcdd14c259551d843a157814fd0ff3589e8f.1441373012.git.zhaolei@cn.fujitsu.com> 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 accross 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-accross-stripes bug in all version. Signed-off-by: Zhao Lei --- tests/misc-tests/008-leaf-accross-stripes/test.sh | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 tests/misc-tests/008-leaf-accross-stripes/test.sh diff --git a/tests/misc-tests/008-leaf-accross-stripes/test.sh b/tests/misc-tests/008-leaf-accross-stripes/test.sh new file mode 100755 index 0000000..4801dce --- /dev/null +++ b/tests/misc-tests/008-leaf-accross-stripes/test.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# test btrfs subvolume run normally with more than one subvolume +# +# - btrfs subvolume must not loop indefinetelly +# - btrfs subvolume return 0 in normal case + +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 accross stripes in btrfs-convert" +done