From patchwork Thu Jan 12 03:53:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 9512059 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 0E60660710 for ; Thu, 12 Jan 2017 03:53:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F345E28670 for ; Thu, 12 Jan 2017 03:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E81F22867A; Thu, 12 Jan 2017 03:53:56 +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=ham 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 57CFD28670 for ; Thu, 12 Jan 2017 03:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbdALDxr (ORCPT ); Wed, 11 Jan 2017 22:53:47 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:6674 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752796AbdALDxo (ORCPT ); Wed, 11 Jan 2017 22:53:44 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="14699385" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Jan 2017 11:53:23 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 4787847B0C8A; Thu, 12 Jan 2017 11:53:20 +0800 (CST) Received: from localhost.localdomain (10.167.226.129) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 12 Jan 2017 11:53:20 +0800 From: Su Yue To: CC: Subject: [PATCH v3 3/3] btrfs-progs: fsck-tests/016: lowmem mode check for images Date: Thu, 12 Jan 2017 11:53:30 +0800 Message-ID: <20170112035330.21376-3-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170112035330.21376-1-suy.fnst@cn.fujitsu.com> References: <20170112035330.21376-1-suy.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.129] X-yoursite-MailScanner-ID: 4787847B0C8A.A868E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suy.fnst@cn.fujitsu.com 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 Since lowmem mode can repair inode nbytes error now, modify this test case to allow lowmem mode repair. Signed-off-by: Su Yue --- v3: add this patch. --- tests/fsck-tests/016-wrong-inode-nbytes/test.sh | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tests/fsck-tests/016-wrong-inode-nbytes/test.sh diff --git a/tests/fsck-tests/016-wrong-inode-nbytes/test.sh b/tests/fsck-tests/016-wrong-inode-nbytes/test.sh new file mode 100755 index 0000000..f8466cb --- /dev/null +++ b/tests/fsck-tests/016-wrong-inode-nbytes/test.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# check inode nbytes in both normal and lowmem mode + +source $TOP/tests/common + +check_prereq btrfs + +check_image() { + local image + local image2; + + image=$1 + image2=$image"_2" + cp "$image" "$image2" + + echo "testing image $(basename $image)" >> "$RESULTS" + "$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1 + [ $? -eq 0 ] && _fail "btrfs check should have detected corruption" + + run_check "$TOP/btrfs" check --repair "$image" + run_check "$TOP/btrfs" check "$image" + + echo "testing image $(basename $image2)" >> "$RESULTS" + "$TOP/btrfs" check --mode=lowmem "$image2" >> "$RESULTS" 2>&1 + [ $? -eq 0 ] && _fail "btrfs lowmem check should detected corruption" + + run_check "$TOP/btrfs" check --mode=lowmem --repair "$image2" + run_check "$TOP/btrfs" check --mode=lowmem "$image2" + + rm "$image2" +} + +check_all_images