From patchwork Tue Jun 26 23:43:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 10491793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F96B60375 for ; Wed, 27 Jun 2018 14:30:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F4C52937C for ; Wed, 27 Jun 2018 14:30:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82B32293A1; Wed, 27 Jun 2018 14:30:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_12_24, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC132937C for ; Wed, 27 Jun 2018 14:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934172AbeF0OaA (ORCPT ); Wed, 27 Jun 2018 10:30:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:49098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933915AbeF0O37 (ORCPT ); Wed, 27 Jun 2018 10:29:59 -0400 Received: from debian3.lan (bl11-80-66.dsl.telepac.pt [85.244.80.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C671208A3; Wed, 27 Jun 2018 14:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530109798; bh=6Vf59DfC18o4m2PTKq0RiSfiH2nWiuXiIDA3iu8Z3wQ=; h=From:To:Cc:Subject:Date:From; b=WMjveTQyEurCE2T5MnDRlY70r9wrApqkK+J3n3iBuhjB1YOSLkbOZO4+sUb/BjG/F 5105c9R2W4UrOMG/6uxQueyW6T+Dwc302ZdjF1f0hNXEjFfzVtNxGkWFUWUDaWlW+2 3gKrPBD++cb85do/nf3qX/kKPEI8zecD8ysX17ZM= From: fdmanana@kernel.org To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Filipe Manana Subject: [PATCH] fstests: test power failure on btrfs while qgroups rescan is in progress Date: Wed, 27 Jun 2018 00:43:27 +0100 Message-Id: <20180626234327.15691-1-fdmanana@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Filipe Manana Test that if a power failure happens on a filesystem with quotas (qgroups) enabled while the quota rescan kernel thread is running, we will be able to mount the filesystem after the power failure. This test is motivated by a recent regression introduced in the linux kernel's 4.18 merge window and is fixed by a patch with the title: "Btrfs: fix mount failure when qgroup rescan is in progress" Signed-off-by: Filipe Manana --- tests/btrfs/166 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/166.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 60 insertions(+) create mode 100755 tests/btrfs/166 create mode 100644 tests/btrfs/166.out diff --git a/tests/btrfs/166 b/tests/btrfs/166 new file mode 100755 index 00000000..c74b0861 --- /dev/null +++ b/tests/btrfs/166 @@ -0,0 +1,57 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved. +# +# FSQA Test No. 166 +# +# Test that if a power failure happens on a filesystem with quotas (qgroups) +# enabled while the quota rescan kernel thread is running, we will be able +# to mount the filesystem after the power failure. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + _cleanup_flakey + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/dmflakey + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_dm_target flakey + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 +_require_metadata_journaling $SCRATCH_DEV +_init_flakey +_mount_flakey + +# Enable qgroups on the filesystem. This will start the qgroup rescan kernel +# thread. +_run_btrfs_util_prog quota enable $SCRATCH_MNT + +# Simulate a power failure, while the qgroup rescan kernel thread is running, +# and then mount the filesystem to check that mounting the filesystem does not +# fail. +_flakey_drop_and_remount + +_unmount_flakey +_cleanup_flakey + +echo "Silence is golden" +status=0 +exit diff --git a/tests/btrfs/166.out b/tests/btrfs/166.out new file mode 100644 index 00000000..1b1db1f8 --- /dev/null +++ b/tests/btrfs/166.out @@ -0,0 +1,2 @@ +QA output created by 166 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 9988cedd..e68aa1b7 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -168,3 +168,4 @@ 163 auto quick volume 164 auto quick volume 165 auto quick subvol +166 auto quick qgroup