From patchwork Tue Feb 9 01:12:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 8256791 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 AA8EBBEEED for ; Tue, 9 Feb 2016 01:12:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D178B202C8 for ; Tue, 9 Feb 2016 01:12:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF57D202D1 for ; Tue, 9 Feb 2016 01:12:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932776AbcBIBM2 (ORCPT ); Mon, 8 Feb 2016 20:12:28 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:32695 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932359AbcBIBM1 (ORCPT ); Mon, 8 Feb 2016 20:12:27 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u191CJL8019017 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2016 01:12:20 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u191CJmR008821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 9 Feb 2016 01:12:19 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u191CJ9O027517; Tue, 9 Feb 2016 01:12:19 GMT Received: from localhost (/10.145.178.207) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 08 Feb 2016 17:12:18 -0800 Subject: [PATCH 05/23] common/dmerror: add some more dmerror routines From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, xfs@oss.sgi.com Date: Mon, 08 Feb 2016 17:12:17 -0800 Message-ID: <20160209011217.23099.26572.stgit@birch.djwong.org> In-Reply-To: <20160209011145.23099.95354.stgit@birch.djwong.org> References: <20160209011145.23099.95354.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: userv0022.oracle.com [156.151.31.74] 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.2 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 Add functions to the dmerror routine so that we can load both the error table and the linear table. This will help us with EIO testing of copy-on-write. Signed-off-by: Darrick J. Wong --- common/dmerror | 27 +++++++++++++++++++++++++-- tests/btrfs/100 | 2 +- tests/btrfs/101 | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/common/dmerror b/common/dmerror index 3900a4e..004530d 100644 --- a/common/dmerror +++ b/common/dmerror @@ -46,15 +46,23 @@ _dmerror_mount() _mount -t $FSTYP `_dmerror_mount_options $*` } +_dmerror_unmount() +{ + umount $SCRATCH_MNT +} + _dmerror_cleanup() { $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 $DMSETUP_PROG remove error-test > /dev/null 2>&1 } -_dmerror_load_table() +_dmerror_load_error_table() { - $DMSETUP_PROG suspend error-test + suspend_opt="--nolockfs" + [ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt="" + + $DMSETUP_PROG suspend $suspend_opt error-test [ $? -ne 0 ] && _fail "dmsetup suspend failed" $DMSETUP_PROG load error-test --table "$DMERROR_TABLE" @@ -63,3 +71,18 @@ _dmerror_load_table() $DMSETUP_PROG resume error-test [ $? -ne 0 ] && _fail "dmsetup resume failed" } + +_dmerror_load_working_table() +{ + suspend_opt="--nolockfs" + [ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt="" + + $DMSETUP_PROG suspend $suspend_opt error-test + [ $? -ne 0 ] && _fail "dmsetup suspend failed" + + $DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE" + [ $? -ne 0 ] && _fail "dmsetup failed to load error table" + + $DMSETUP_PROG resume error-test + [ $? -ne 0 ] && _fail "dmsetup resume failed" +} diff --git a/tests/btrfs/100 b/tests/btrfs/100 index 080d0ae..cd385e1 100755 --- a/tests/btrfs/100 +++ b/tests/btrfs/100 @@ -69,7 +69,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \ "$snapshot_cmd" -X 50 # now load the error into the DMERROR_DEV -_dmerror_load_table +_dmerror_load_error_table _run_btrfs_util_prog replace start -B $error_devid $dev2 $SCRATCH_MNT diff --git a/tests/btrfs/101 b/tests/btrfs/101 index 0824de1..8d7af85 100755 --- a/tests/btrfs/101 +++ b/tests/btrfs/101 @@ -70,7 +70,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \ "$snapshot_cmd" -X 50 # now load the error into the DMERROR_DEV -_dmerror_load_table +_dmerror_load_error_table _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT