From patchwork Mon Aug 14 07:03:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 9898165 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 B378B602BA for ; Mon, 14 Aug 2017 07:03:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A70DF285A3 for ; Mon, 14 Aug 2017 07:03:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BDCB285A9; Mon, 14 Aug 2017 07:03:30 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 4D826285A3 for ; Mon, 14 Aug 2017 07:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbdHNHD1 (ORCPT ); Mon, 14 Aug 2017 03:03:27 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:23259 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752314AbdHNHDZ (ORCPT ); Mon, 14 Aug 2017 03:03:25 -0400 X-IronPort-AV: E=Sophos;i="5.41,372,1498492800"; d="scan'208";a="23496047" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Aug 2017 15:03:23 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 718D04724390; Mon, 14 Aug 2017 15:03:22 +0800 (CST) Received: from fnst.localdomin (10.167.226.155) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 14 Aug 2017 15:03:24 +0800 From: Lu Fengqi To: , CC: Subject: [PATCH] fstests: btrfs: enhance regression test for nocsum dio read's repair Date: Mon, 14 Aug 2017 15:03:13 +0800 Message-ID: <20170814070313.20092-1-lufq.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Originating-IP: [10.167.226.155] X-yoursite-MailScanner-ID: 718D04724390.A8E64 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I catch this following error from dmesg when this testcase fails. [17446.661127] Buffer I/O error on dev sdb1, logical block 64, async page read We expect to inject disk IO errors on the device when xfs_io reads the specific file, but other processes may trigger IO error earlier. So, we can use task-filter to solve this problem. Signed-off-by: Lu Fengqi --- tests/btrfs/142 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/btrfs/142 b/tests/btrfs/142 index 414af1b2..5bd8b728 100755 --- a/tests/btrfs/142 +++ b/tests/btrfs/142 @@ -75,6 +75,7 @@ start_fail() { echo 100 > $DEBUGFS_MNT/fail_make_request/probability echo 2 > $DEBUGFS_MNT/fail_make_request/times + echo 1 > $DEBUGFS_MNT/fail_make_request/task-filter echo 0 > $DEBUGFS_MNT/fail_make_request/verbose echo 1 > $SYSFS_BDEV/make-it-fail } @@ -83,6 +84,7 @@ stop_fail() { echo 0 > $DEBUGFS_MNT/fail_make_request/probability echo 0 > $DEBUGFS_MNT/fail_make_request/times + echo 0 > $DEBUGFS_MNT/fail_make_request/task-filter echo 0 > $SYSFS_BDEV/make-it-fail } @@ -118,16 +120,17 @@ echo "step 3......repair the bad copy" >>$seqres.full # since raid1 consists of two copies, and the bad copy was put on stripe #1 # while the good copy lies on stripe #0, the bad copy only gets access when the # reader's pid % 2 == 1 is true -while true; do - # start_fail only fails the following dio read so the repair is +start_fail +while [[ -z ${result} ]]; do + # enable task-filter only fails the following dio read so the repair is # supposed to work. - start_fail - $XFS_IO_PROG -d -c "pread -b 128K 0 128K" "$SCRATCH_MNT/foobar" > /dev/null & - pid=$! - wait - stop_fail - [ $((pid % 2)) == 1 ] && break + result=$(bash -c " + if [[ \$((\$\$ % 2)) -eq 1 ]]; then + echo 1 > /proc/\$\$/make-it-fail + exec $XFS_IO_PROG -d -c \"pread -b 128K 0 128K\" \"$SCRATCH_MNT/foobar\" + fi"); done +stop_fail _scratch_unmount