From patchwork Mon Feb 6 05:47:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9557109 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 81D14604DC for ; Mon, 6 Feb 2017 05:48:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90B9B267EC for ; Mon, 6 Feb 2017 05:48:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85A2C27CF3; Mon, 6 Feb 2017 05:48:12 +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 31EC926E39 for ; Mon, 6 Feb 2017 05:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbdBFFsE (ORCPT ); Mon, 6 Feb 2017 00:48:04 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:11354 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751225AbdBFFsD (ORCPT ); Mon, 6 Feb 2017 00:48:03 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="15312250" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 06 Feb 2017 13:47:45 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id D641D42B4B03; Mon, 6 Feb 2017 13:47:45 +0800 (CST) Received: from localhost.localdomain (10.167.226.34) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Feb 2017 13:47:48 +0800 From: Qu Wenruo To: CC: , , Subject: [PATCH v2 10/12] btrfs-progs: fsck-test: Add new test case for file extent false alerts Date: Mon, 6 Feb 2017 13:47:33 +0800 Message-ID: <20170206054735.5227-11-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170206054735.5227-1-quwenruo@cn.fujitsu.com> References: <20170206054735.5227-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: D641D42B4B03.AD5E0 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@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 Lowmem mode exposed several false alerts, all related to file extents check. 1) Partly written prealloc extent Cause lowmem mode to report missing csum or prealloc extent should not have csum 2) Compressed inline extent Cause lowmem mode to find mismatch on inline len and item len. While no error message is output but exit silently. Reported-by: Chris Murphy Reported-by: Christoph Anton Mitterer Signed-off-by: Qu Wenruo --- tests/fsck-tests/025-file-extents/test.sh | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tests/fsck-tests/025-file-extents/test.sh diff --git a/tests/fsck-tests/025-file-extents/test.sh b/tests/fsck-tests/025-file-extents/test.sh new file mode 100755 index 00000000..cb64c500 --- /dev/null +++ b/tests/fsck-tests/025-file-extents/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Confirm btrfs check can check file extents without causing false alert + +source $TOP/tests/common + +check_prereq btrfs +check_prereq mkfs.btrfs +check_global_prereq xfs_io +check_global_prereq fallocate + +setup_root_helper +prepare_test_dev 128M + +# Do some write into a large prealloc range +# Lowmem mode can report missing csum due to wrong csum range +test_paritical_write_into_prealloc() +{ + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV" + run_check_mount_test_dev + + run_check fallocate -l 128K "$TEST_MNT/file" + sync + run_check xfs_io -c "pwrite 0 64K" "$TEST_MNT/file" + run_check_umount_test_dev + run_check "$TOP/btrfs" check "$TEST_DEV" +} + +# Inline compressed file extent +# Lowmem mode can cause silent error without any error message +# due to too restrict check on inline extent size +test_compressed_inline_extent() +{ + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV" + run_check_mount_test_dev -o compress=lzo,max_inline=2048 + + run_check xfs_io -f -c "pwrite 0 1K" "$TEST_MNT/file" + run_check_umount_test_dev + run_check "$TOP/btrfs" check "$TEST_DEV" +} + +test_paritical_write_into_prealloc +test_compressed_inline_extent