From patchwork Wed Oct 15 18:37:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 5086531 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 630CF9F30B for ; Wed, 15 Oct 2014 17:38:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63FEE20155 for ; Wed, 15 Oct 2014 17:38:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 239A720109 for ; Wed, 15 Oct 2014 17:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751255AbaJORiV (ORCPT ); Wed, 15 Oct 2014 13:38:21 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:39559 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750993AbaJORiU (ORCPT ); Wed, 15 Oct 2014 13:38:20 -0400 Received: by mail-wi0-f182.google.com with SMTP id n3so2558929wiv.15 for ; Wed, 15 Oct 2014 10:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=QC30tPQAZAcK60jAV7g0Kdh7hQTfNvXvGK0esnqofgo=; b=wMA/5Ia9rndoyF1lkiPmiO6YEHpaNomk8mB6inelhMBIOc0+NyQteSHnPL+DnBZ7gd xkGQE9GHu7Rk5aw2JAfUDxfv8zTdfV3C2KJGbwDLv5R6onNr0n/xYMB9IOIL8T2D3lD+ YGnFCX0Wd3S69ziCuXx45NGzHjCkWIkIZNOCT6EfB4SrKLbomNZVISuRW9oXBuuqozss KaHsZewi0BiOBj5fkMYmGCQDwuVL6IdPtpA9V6wHKx2/hWChPnPdMH5vsmPrIELM+1za GK+DgYbveHJcMgL8CE8VuZ5Y2st9zGFtaskS4NAAF/zAjdZGBr4/HHHXtQr4WjtKiwrG JLcA== X-Received: by 10.180.21.163 with SMTP id w3mr13966229wie.66.1413394699546; Wed, 15 Oct 2014 10:38:19 -0700 (PDT) Received: from debian-vm3.lan (bl9-95-210.dsl.telepac.pt. [85.242.95.210]) by mx.google.com with ESMTPSA id ma8sm24581606wjb.46.2014.10.15.10.38.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Oct 2014 10:38:18 -0700 (PDT) From: Filipe Manana X-Google-Original-From: Filipe Manana To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Filipe Manana Subject: [PATCH] fstests: btrfs: regression test for ro snapshot creation Date: Wed, 15 Oct 2014 19:37:56 +0100 Message-Id: <1413398276-17365-1-git-send-email-fdmanana@suse.com> X-Mailer: git-send-email 1.9.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 Regression test for a btrfs issue where creation of readonly snapshots caused the filesystem to get into an inconsistent state. This regression was introduced in the 3.17 kernel and fixed by reverting the following linux kernel commit: Btrfs: race free update of commit root for ro snapshots 9c3b306e1c9e6be4be09e99a8fe2227d1005effc Signed-off-by: Filipe Manana Reviewed-by: Josef Bacik --- tests/btrfs/078 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/078.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 88 insertions(+) create mode 100755 tests/btrfs/078 create mode 100644 tests/btrfs/078.out diff --git a/tests/btrfs/078 b/tests/btrfs/078 new file mode 100755 index 0000000..48de357 --- /dev/null +++ b/tests/btrfs/078 @@ -0,0 +1,85 @@ +#! /bin/bash +# FSQA Test No. 078 +# +# Regression test for a btrfs issue where creation of readonly snapshots caused +# the filesystem to get into an inconsistent state. +# +# This regression was introduced in the 3.17 kernel and fixed by reverting the +# following linux kernel commit: +# +# Btrfs: race free update of commit root for ro snapshots +# 9c3b306e1c9e6be4be09e99a8fe2227d1005effc +# +#----------------------------------------------------------------------- +# +# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved. +# Author: Filipe Manana +# +# 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" + +tmp=`mktemp -d` +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -fr $tmp +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_need_to_be_root +_supported_fs btrfs +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +workout() +{ + ops=$1 + procs=$2 + num_snapshots=$3 + + _scratch_mkfs >> $seqres.full 2>&1 + _scratch_mount + + snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT" + snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`" + run_check $FSSTRESS_PROG -p $procs \ + -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops +} + +ops=8000 +procs=4 +snapshots=100 +workout $ops $procs $snapshots + +# The fstests framework runs a file system check against the scratch device +# automatically when a test case finishes (if the test calls _require_scratch). +# That filesystem check (btrfsck, btrfs.fsck) failed reporting several fs +# inconsistencies. Therefore there's no need to call _check_scratch_fs here. + +echo "Silence is golden" +status=0 +exit diff --git a/tests/btrfs/078.out b/tests/btrfs/078.out new file mode 100644 index 0000000..b8acea8 --- /dev/null +++ b/tests/btrfs/078.out @@ -0,0 +1,2 @@ +QA output created by 078 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 9adf862..40e7430 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -80,3 +80,4 @@ 075 auto quick subvol 076 auto quick 077 auto quick +078 auto