From patchwork Thu Oct 10 04:52:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 3013881 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CF2B6BF924 for ; Thu, 10 Oct 2013 04:53:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00C30202F9 for ; Thu, 10 Oct 2013 04:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 236B220306 for ; Thu, 10 Oct 2013 04:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193Ab3JJEwf (ORCPT ); Thu, 10 Oct 2013 00:52:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17856 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751796Ab3JJEwe (ORCPT ); Thu, 10 Oct 2013 00:52:34 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9A4qUmM019352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Oct 2013 00:52:31 -0400 Received: from localhost (vpn1-115-172.nay.redhat.com [10.66.115.172]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9A4qTDp001730; Thu, 10 Oct 2013 00:52:30 -0400 From: Eryu Guan To: xfs@oss.sgi.com Cc: linux-btrfs@vger.kernel.org, Eryu Guan Subject: [PATCH] xfstests btrfs/012: test balance while creating and deleting subvolumes Date: Thu, 10 Oct 2013 12:52:13 +0800 Message-Id: <1381380733-27117-1-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Do subvolume create/delete in loop at back ground and do filesystem balance at the same time could trigger kernel BUG at fs/btrfs/relocation.c:2255! on 3.12-rc4 kernel. Signed-off-by: Eryu Guan --- tests/btrfs/012 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/012.out | 11 ++++++++ tests/btrfs/group | 1 + 3 files changed, 86 insertions(+) create mode 100755 tests/btrfs/012 create mode 100644 tests/btrfs/012.out diff --git a/tests/btrfs/012 b/tests/btrfs/012 new file mode 100755 index 0000000..3f72a9b --- /dev/null +++ b/tests/btrfs/012 @@ -0,0 +1,74 @@ +#! /bin/bash +# FS QA Test No. btrfs/012 +# +# Test btrfs balance while creating and deleting subvolumes +# +# On buggy kernel this could trigger: +# kernel BUG at fs/btrfs/relocation.c:2255! +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +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/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_scratch_dev_pool + +subvolume=subvol_$seq +rm -f $seqres.full + +subvolume_create_delete() +{ + while true; do + $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/$subvolume >/dev/null + $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/$subvolume >/dev/null + done +} + +_scratch_pool_mkfs >> $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +subvolume_create_delete & + +for i in `seq 1 10`;do + $BTRFS_UTIL_PROG filesystem balance start $SCRATCH_MNT >>$seqres.full 2>&1 + echo "Done balance loop $i" +done +kill $! +wait + +# No crash, test passed +status=0 +exit diff --git a/tests/btrfs/012.out b/tests/btrfs/012.out new file mode 100644 index 0000000..9604f1b --- /dev/null +++ b/tests/btrfs/012.out @@ -0,0 +1,11 @@ +QA output created by 012 +Done balance loop 1 +Done balance loop 2 +Done balance loop 3 +Done balance loop 4 +Done balance loop 5 +Done balance loop 6 +Done balance loop 7 +Done balance loop 8 +Done balance loop 9 +Done balance loop 10 diff --git a/tests/btrfs/group b/tests/btrfs/group index d2fe030..c12b9e9 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -14,3 +14,4 @@ 009 auto quick 010 auto quick 011 auto +012 auto quick