From patchwork Tue Oct 29 12:09:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 13854819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 734BBD2AB34 for ; Tue, 29 Oct 2024 12:11:56 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1t5l4m-0002aR-3u; Tue, 29 Oct 2024 12:11:56 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1t5l4k-0002a4-Op for linux-f2fs-devel@lists.sourceforge.net; Tue, 29 Oct 2024 12:11:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xq4pN+uvzWSi8xNo4irA6tLUxKSWf/glYr/mQAEgsVs=; b=CI1fBPpokTuNhXS5A08vzjtiEo 9IWP3wBlI6mtskF9RzX7yu1spNCTPuYXjPxvzaIKjn4PIcjWfP8qA1+qwNJelNxNuBFNN+7YlTqGy W23buBVWKA6LhIXrrJbRwhsvwlbSNueC52rHvU1cfC3zlXedLJIS8KYKvi0x2F5FaH1w=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=xq4pN+uvzWSi8xNo4irA6tLUxKSWf/glYr/mQAEgsVs=; b=FD93fiuGL+8te/uExRlPzspG3k 8sY1b9EtNzUwsnn1BpjIhZPVcP3532CzmvQFgcCUjRATZd0QoFwNpyRmi83G1JlQ/oyNKnKXgZEJ5 Xq03z+KydX38IBWjRJ45aLxLfRNMtrv7ziqEgrVruex3qiLGr1Pc6olXT5i0jTQ5cEfE=; Received: from mail-psaapc01on2053.outbound.protection.outlook.com ([40.107.255.53] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1t5l4k-0007R0-1F for linux-f2fs-devel@lists.sourceforge.net; Tue, 29 Oct 2024 12:11:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eo8kNqwtsp8rCCCS/p8HjMZKpiqzlX79Yifll8roOi9UxTK+2fORLDNngKsNBA6zL4eFb37v3PCyPMTvuh8CKQRmRoDsS6qPwtI2GTg/a6aXdvVVSGGc+q1worceNou0HzMwHNLBdVoGNDcsPbw6FRAZ0YlUwAl0ifhI1kWNDj2+N1QS/lLq9LFD1rwf7Owefx/SWZB3VRSq85PnPmb+My63DxTk7MLC6BYciexY8q79fvub/J22DeuNbKROQCk3Uq0TdaMvl9TczevNGbgesOwTcz1FZr37rZ43KObsnNw1ILEotxDvkWzqy+1kt8DSKFfgPIaRt7Ny8pFEqDh7lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xq4pN+uvzWSi8xNo4irA6tLUxKSWf/glYr/mQAEgsVs=; b=kLAx/PR2mM+GqHA6fO6fDRUJSkmMqVJIKeSDjGdVbWWdi7bGAUikTsKeC2AG+Oy5Hyx7nDBSinILbdf0in/EXiwt8JJ47Qq7tfbPvzychzII9fDhgyR2Ce6WXk2k7/pBZbvhN5Jfz8eXFOpeB4HVxGudgtNx7gHmQ77EIcy4Z4IpdULQ4hsKiXb4VH40A4FLMHNikluu2Sa/MoTbaRFj57RSlBNHFZB8s1ZJ/kDBbRaxna9igagFpepO6VBmk1GzCxtK5gUvLOZfcoLIdxTWhhHhIxtd/vjVotjjKKxIOIgP6ZFSPlEcRalRVC7ycEZgtTpZodgbF3hT2eMxUjXiuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xq4pN+uvzWSi8xNo4irA6tLUxKSWf/glYr/mQAEgsVs=; b=NNY3W+w7WrScwk1kOFwfO00a0e0YCE8o1WZb9r7UbAhTDozupmJ8LsjTr6Zk6eiY4HI5pgBnWSkFMrARWQAa7T5vMAhasMNUzL9zqTxdOKRmp5TTpf1nB2vdvsaSF7PMBrdnDuFhA29tBSzxNBm+ULmafjLuGNY50iuabCedTnA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) by SEZPR02MB7326.apcprd02.prod.outlook.com (2603:1096:101:1f4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 12:11:39 +0000 Received: from SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796]) by SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796%7]) with mapi id 15.20.8093.023; Tue, 29 Oct 2024 12:11:39 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Tue, 29 Oct 2024 20:09:42 +0800 Message-Id: <20241029120956.4186731-11-shengyong@oppo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241029120956.4186731-1-shengyong@oppo.com> References: <20241029120956.4186731-1-shengyong@oppo.com> X-ClientProxiedBy: SG2PR01CA0175.apcprd01.prod.exchangelabs.com (2603:1096:4:28::31) To SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR02MB6014:EE_|SEZPR02MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 52c1033c-a08e-4e2b-71b1-08dcf812d7d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: IbuKO0kDlY+yXIZmg8n1f4IMBUlQYQQY8H/1o76OdIfyRoIjjhTWL7HDVa9Xbn8aH2vKqddX0c9JEyOkdtgonryK9mNeyhE9JniVFkny+k848r09bUNFEIsiE1HLH5BxcZ9bBndwT3WG7j+LjDNB0P9sDmbu+5XFiAxlZ3Y38AlDC9YKEZ50cdqPGO2zo/q68NWoVEFRzdBsAWxrfeRgIYlMIMqnipC27+QQJVe4/68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Bjo7NHB2/bdTqdeLN8eRyU1abegi5jiHV7Sa2IeZboC9SP+uEf6FzL3SbYBAZgu1m0Gp+Ehg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEYPR02MB6014.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jlPSYSuJ+2M19PoEbg0ypkdNxZ/jjyuQyAzps3J8LitZ1yF/wkmJH2nYh1vHm3lqKvXOckVXyC23cgk2sHCmZN6FPKlcfArIHxbJN1GU+uykbXQ8xdTZPjQ31mPS6/p4N/UXSawGBmZpWoiKewqAx8A/MmEaEEamryv197zhM3k6aGiRtskWUvai0UfXxBiTu3s4XniTqFO1GMhlq5Zh1YxnyFGZTrg+SOciEPY+ouQcLbDHdjpTw2agEmspql3MGQ7LlDkjRiYquiODcoCBn+lB8uFLwUBCXiedz8K4eSqGS9WwqeuaCai+ds82MG2M0M/21Sh8ciEJFXTtdmtW5JizdPljm7WnU6ca/by1V5eZgsRPeObrITyGsUjh7e1gZL8oQx/1djtFKGpTg4n+yVLd0gLAFbu3d029fdmZCR/P5uGP8CBiP/oGJLeyMe1JaY63P9AVVlnGoBtjktUiwuMfm+tv4idkGqLZ+RiTDLjteU4e9MbiO0ZkhvKo6//QJyxzMt/uNi7Be7qI73ecZUiXhP38lzqZpzBknYQDb2YbhbnUlEUy2w/oX9qsQDUHZ0EvvORbeYsRDozTM00lkNyWR60T8MVdufGNWObK0eHRD8FqjXFGit8+2dCCdSDQ1nvVNpMjr+HJUByKiFdW5DmJWu/NtWe+kNDIN5QPBEZA8GE6G7+iLalphMOztAeBINMYiJQ8C/+zNo3Qv7LAfE+u2lOX4nmbVBMpkyUntD+seaXva/rflEtrcXrgBSu6tUA6UAB5NZKeW5V1jhcRrTFcdYIAYLBRgunkkznmcQ7pp7vGttBjXJ+m1lU3IpEx9cFGa5mml/DW77zdyGQM4/ZpjjSG5JOKUaZg42ntJJ/Y1ZWq4iFrBvJTOzP/Rzu9Om6VWBII8bMG9jHc+G+LlnJcE9iWxzFqvd7LWiVwW7n3TminYePr+p64d+85M+ijxZxuD9curutC49+jlBr6mmo25y0utgCGdTpgVy1DAHEmMgIFggLBkBqY1+1QJjigOBktn+Q2yEZqgdLftRWIsNHEGxJvutNqwNZihTNCzIwKJ4z/nL2xNi5U6h1oMSC84oK3cyan3r676PFdn2fMrtqonjE9ttXWzgXAdMJN82q6lrEljUAOLqnX034ZK9W3pDLmjc+oQretDe8OHtJ5YiVQj0zn+uAMmjjuenNLn0Pn/mYTH9zkrO1tDD5JS+2fVOeKuyHzefK7VYKYeFTdqUpFyu4zC1XIPX42Z76/fei0GKCcqFp7sFBzUeEfKEjv6DdOJm8gL1ej/2bZz/nVkYEAcFvR7OOpoULhxeWMGk8FCdnt6PdP1nDRnV91BOUB7CciIjHu33LoESkzWahFuCDpcCyt+hctNVbxlrMwL7OR4MeEsGfv6JIqDL6K2ml+wHwQDVqqxhxDOm4MBmWK3PLl5ZoB3nErdtgIRXYfM9yGQVKSZVo0rg3P1OXzIMWFvNouLdC9e9KCxQQkm6/9q/IJbrzzoW4S3VMO4b+6qT621sQXABHf9KqHg3Y/HfAGkPxxWtk7XfKi6kVVElWNVHSF1li+FYx2SbikltsTJVMNwLmPHBzKmjLaDdhoip4j X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52c1033c-a08e-4e2b-71b1-08dcf812d7d8 X-MS-Exchange-CrossTenant-AuthSource: SEYPR02MB6014.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 12:11:39.5840 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XCSbTV4bHUy5Y6CEw9mKmNK7niEWzAeXwkThj22iNQrySZfU6b/fO0SRKJpZN+A2TpPwsO2dEqH1eprYbFidnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB7326 X-Headers-End: 1t5l4k-0007R0-1F Subject: [f2fs-dev] [RFC PATCH 10/24] tests: add fsck testcase of fixing errors recorded in sb X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sheng Yong via Linux-f2fs-devel From: Sheng Yong Reply-To: Sheng Yong Cc: linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Signed-off-by: Sheng Yong --- tests/f_sb_errors/README | 5 ++++ tests/f_sb_errors/expect.in | 59 +++++++++++++++++++++++++++++++++++++ tests/f_sb_errors/script | 23 +++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tests/f_sb_errors/README create mode 100644 tests/f_sb_errors/expect.in create mode 100644 tests/f_sb_errors/script diff --git a/tests/f_sb_errors/README b/tests/f_sb_errors/README new file mode 100644 index 000000000000..df118e825aac --- /dev/null +++ b/tests/f_sb_errors/README @@ -0,0 +1,5 @@ +1. create f2fs image +2. inject s_stop_reason in super block +3. fsck -a detects error and clear the error +4. inject s_errors in super block +5. fsck -a detects error and clear the error diff --git a/tests/f_sb_errors/expect.in b/tests/f_sb_errors/expect.in new file mode 100644 index 000000000000..ea93e95c8192 --- /dev/null +++ b/tests/f_sb_errors/expect.in @@ -0,0 +1,59 @@ +Info: Automatic fix mode enabled. +Info: checkpoint stop reason: fault_inject(1) +Info: Write valid nat_bits in checkpoint +Info: checkpoint state = x : nat_bits compacted_summary unmount + +[FSCK] Unreachable nat entries [Ok..] [x] +[FSCK] SIT valid block bitmap checking [Ok..] +[FSCK] Hard link checking for regular file [Ok..] [x] +[FSCK] valid_block_count matching with CP [Ok..] [x] +[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x] +[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x] +[FSCK] valid_inode_count matched with CP [Ok..] [x] +[FSCK] free segment_count matched with CP [Ok..] [x] +[FSCK] next block offset is free [Ok..] +[FSCK] fixing SIT types +[FSCK] other corrupted bugs [Ok..] +Info: Duplicate valid checkpoint to mirror position x -> x +Info: Write valid nat_bits in checkpoint +Info: write_checkpoint() cur_cp:x +Info: Write valid nat_bits in checkpoint +Info: fix_checkpoint() cur_cp:x +[update_superblock: x] Info: Done to update superblock + +Info: Automatic fix mode enabled. +Info: fs errors: fail_decompression +Info: checkpoint state = x : allow_nocrc nat_bits unmount + +[FSCK] Unreachable nat entries [Ok..] [x] +[FSCK] SIT valid block bitmap checking [Ok..] +[FSCK] Hard link checking for regular file [Ok..] [x] +[FSCK] valid_block_count matching with CP [Ok..] [x] +[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x] +[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x] +[FSCK] valid_inode_count matched with CP [Ok..] [x] +[FSCK] free segment_count matched with CP [Ok..] [x] +[FSCK] next block offset is free [Ok..] +[FSCK] fixing SIT types +[FSCK] other corrupted bugs [Ok..] +[update_superblock: x] Info: Done to update superblock + +Info: Automatic fix mode enabled. +Info: checkpoint state = x : allow_nocrc nat_bits unmount +Info: No error was reported + +Info: Force to fix corruption +Info: checkpoint state = x : allow_nocrc nat_bits unmount + +[FSCK] Unreachable nat entries [Ok..] [x] +[FSCK] SIT valid block bitmap checking [Ok..] +[FSCK] Hard link checking for regular file [Ok..] [x] +[FSCK] valid_block_count matching with CP [Ok..] [x] +[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x] +[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x] +[FSCK] valid_inode_count matched with CP [Ok..] [x] +[FSCK] free segment_count matched with CP [Ok..] [x] +[FSCK] next block offset is free [Ok..] +[FSCK] fixing SIT types +[FSCK] other corrupted bugs [Ok..] + diff --git a/tests/f_sb_errors/script b/tests/f_sb_errors/script new file mode 100644 index 000000000000..664e4f6f49fc --- /dev/null +++ b/tests/f_sb_errors/script @@ -0,0 +1,23 @@ +#!/bin/bash + +DESC="superblock[1] with s_stop_reason and s_errors" + +. $TOPDIR/tests/helpers + +cleanup pre > $LOG 2>&1 +make_f2fs >> $LOG 2>&1 + +$INJECT --sb 1 --mb s_stop_reason --idx 1 --val 1 $META >> $LOG 2>&1 +$FSCK $FSCK_OPTS -a $META > $OUT 2>&1 + +$INJECT --sb 1 --mb s_errors --idx 0 --val 2 $META >> $LOG 2>&1 +$FSCK $FSCK_OPTS -a $META >> $OUT 2>&1 + +# both -a and -f cannot detect errors +$FSCK $FSCK_OPTS -a $META >> $OUT 2>&1 +echo "" >> $OUT +$FSCK $FSCK_OPTS -f $META >> $OUT 2>&1 +cat $OUT >> $LOG + +check_result +cleanup post >> $LOG 2>&1