From patchwork Thu Jul 23 20:51:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 6856081 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BA08F9F1D4 for ; Thu, 23 Jul 2015 20:52:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C350D20225 for ; Thu, 23 Jul 2015 20:52:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6EEE2013A for ; Thu, 23 Jul 2015 20:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754441AbbGWUwM (ORCPT ); Thu, 23 Jul 2015 16:52:12 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:47824 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754133AbbGWUwG (ORCPT ); Thu, 23 Jul 2015 16:52:06 -0400 Received: from pps.filterd (m0044008 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t6NKoYGx029373; Thu, 23 Jul 2015 13:52:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=B7QbHpE56d93z0C5hMbcs2roEvgBS1cGAcXbwgVyNh8=; b=LgqmFq5z+l7U5ydzQqEmiz1LxMZcDBxoZg9YrsxNIQisYJLkoEabeibzw4VSmpsHaI14 YW/dKV02ReSOQprHDHxipHAKvkNZfUE8VsF3/E+AIRGbiF/ocEJkBJEqNvb0OhIF+ngJ rmvY5vQZrhZJpbp55D1li6drtLGDCheEgGg= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 1vu6pur5p2-5 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 23 Jul 2015 13:52:05 -0700 Received: from huxley.thefacebook.com (192.168.52.123) by mail.thefacebook.com (192.168.16.15) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 23 Jul 2015 13:52:03 -0700 From: Omar Sandoval To: CC: , Wang Yanfeng , Omar Sandoval Subject: [PATCH 3/3] btrfs: add a test of replace missing dev in diff raid Date: Thu, 23 Jul 2015 13:51:51 -0700 Message-ID: <74be00ec0764de749fe43c1e4b20cc2cc35a4671.1437683940.git.osandov@fb.com> X-Mailer: git-send-email 2.4.6 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-07-23_10:2015-07-22, 2015-07-23, 1970-01-01 signatures=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=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Wang Yanfeng Test of missing device replace in different raid modes. This test requires SCRATCH_DEV_POOL contain 5 same size devices. This issue has been fixed by Omar's patch: Btrfs: RAID 5/6 missing device scrub+replace Signed-off-by: Wang Yanfeng Signed-off-by: Omar Sandoval --- tests/btrfs/095 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/095.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 96 insertions(+) create mode 100755 tests/btrfs/095 create mode 100644 tests/btrfs/095.out diff --git a/tests/btrfs/095 b/tests/btrfs/095 new file mode 100755 index 000000000000..2dfb919fe4f6 --- /dev/null +++ b/tests/btrfs/095 @@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test No. btrfs/095 +# +# Test of missing device replace in different raid mode +# +# Be sure $SCRATCH_DEV_POOL including 5 devices. And all +# devices in pool must be in the same size. +# +# To check the fs after replacing a dev, a scrub run is performed. +# +# This issue has been fixed by Omar Sandoval's patch: +# Btrfs: RAID 5/6 missing device scrub+replace +#----------------------------------------------------------------------- +# Copyright (c) 2015 Fujitsu. All Rights Reserved. +# Author: Wang Yanfeng +# +# 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 +trap "exit \$status" 0 1 2 3 15 + +# 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 +_require_scratch_dev_pool 5 +_btrfs_get_profile_configs replace-missing + +rm -f $seqres.full + +REPLACE_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $5}'` +export SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | awk '{print $1,$2,$3,$4}'` + +run_test () { + local mkfs_opts=$1 + _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1 || _fail "mkfs failed" + _scratch_mount + + PRUNE_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $2}'` + PRUNE_DEV_ID=`$BTRFS_UTIL_PROG fi show $SCRATCH_MNT | grep $PRUNE_DEV | awk '{print $2}'` + + # dd some data + dd if=/dev/urandom of="$SCRATCH_MNT"/file1 bs=1M count=1 \ + >>$seqres.full 2>&1 || _fail "dd failed" + dd if=/dev/urandom of="$SCRATCH_MNT"/file2 bs=1M count=2 \ + >>$seqres.full 2>&1 || _fail "dd failed" + dd if=/dev/urandom of="$SCRATCH_MNT"/file3 bs=1M count=4 \ + >>$seqres.full 2>&1 || _fail "dd failed" + + # prune the device PRUNE_DEV && remount by degraded mode + umount $SCRATCH_MNT + dd if=/dev/zero of=$PRUNE_DEV bs=1M count=1 >>$seqres.full 2>&1 \ + || _fail "dd failed" + mount -o degraded $SCRATCH_DEV $SCRATCH_MNT + + # replace the missing dev $PRUNE_DEV with $REPLACE_DEV and scrub it + $BTRFS_UTIL_PROG replace start -B -r $PRUNE_DEV_ID $REPLACE_DEV \ + $SCRATCH_MNT -f >>$seqres.full 2>&1 || _fail "replace failed" + $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1 \ + || _fail "scrub failed" + + umount $SCRATCH_MNT +} + +echo "Silence is golden" +for t in "${_btrfs_profile_configs[@]}"; do + run_test "$t" +done + +status=0 +exit diff --git a/tests/btrfs/095.out b/tests/btrfs/095.out new file mode 100644 index 000000000000..80ad3b9c2a7b --- /dev/null +++ b/tests/btrfs/095.out @@ -0,0 +1,2 @@ +QA output created by 095 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index ffe18bff0d21..f20a191c24be 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -96,3 +96,4 @@ 092 auto quick send 093 auto quick clone 094 auto quick send +095 auto