From patchwork Sun Sep 29 02:43:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Han X-Patchwork-Id: 13814794 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 C1A73CF6495 for ; Sun, 29 Sep 2024 02:28:12 +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 1sujfO-00079O-KM; Sun, 29 Sep 2024 02:28:10 +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 1sujfM-00079F-8s for linux-f2fs-devel@lists.sourceforge.net; Sun, 29 Sep 2024 02:28:08 +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 :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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XoFp0nePSas7xgzmyhzjFsHoKiflz+dMvPuW83tUaGs=; b=DwEES3UpqBG1BpGRbDaGlNMFpk 7SEhCbAaK+uivz/4BCAngRyrvEqGCxb6jDuU2Dcn8YdKzHbT+Gyy82RFHGMoZC+o0qgJArKkUDdZ1 5MHUt6Qe4sLbeqE+Mp5YenbYGF6FO+46VcxriscHpHjKK1xaPwDE0YGI4yzH9HAftG8w=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=XoFp0nePSas7xgzmyhzjFsHoKiflz+dMvPuW83tUaGs=; b=g +dsnMzQzrnE3VZJv+IvPRjhzB9Uq0Fa/z88v0Dd13KYHlR5fGoB3vEzYnpFC3x8FZbEmogZVcnRxz w/YiD8Z75HpcvqLjwnmt5lVG1Dc9waDgl3JxYjjPtmllf5ZK2g0w5Xq1xeBwXnVUUJQp0U4gYhcNR lGivSxlvLwRRSvcc=; Received: from mail-tyzapc01on2080.outbound.protection.outlook.com ([40.107.117.80] helo=APC01-TYZ-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 1sujfL-0002wh-74 for linux-f2fs-devel@lists.sourceforge.net; Sun, 29 Sep 2024 02:28:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Gl1lI39Gid8tOynzr0uyBENXEjkSN9oznuecpmOf+MkN4XVcCtnWOipmypIhuK8lRhXwqfwfFihobujSCOwhNUjJyxZBwRuMqWTe+KkkreVGeLf/9UUVwraWPdqBjF30pPHTIAH8yMRmGbmG097MAAstDEmSRwyctPHQc46tur4FfqiPHEULbleWB7idCySsTT2kv8x0JNQyI9SSV5iqhf6ZzRra0o7QZAkxelmGU6ZgptgqN9q1HgdQrPg4EwLsVLVkEFcqleuEmzKGICTDORFo8XMDrVRRCH92GW5YYint1AYeRA6piGYbgEjVz6FAExpKm+CNtF+30KDireAmTw== 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=XoFp0nePSas7xgzmyhzjFsHoKiflz+dMvPuW83tUaGs=; b=E6uUC+FmRtiySuQhNjxRkzG63VjPfBSFw7EU51J0E8hmL5O/EGZG37Jd6FioW0u6mTSi4i9AnQGm93rl/rL4y0wBTzxJn4s7O02T+MZXvTDtbGH8WPX7zjl+g5P9Vg9WQmLohL+xehl0d7DcnwXcCNZ4Ll7BZMhQAoxUNWvTZBIn3y6PpYdtyZxsO0mhi9WPmrBQDSNrB28a2TbmOki+4YeJa0f9VBi3vJmnwgB+RrF5ofOFG+RsIXeep9txkTuPxN+gfryi3viXnz9TWvLX0dChzl5SDhS0W3dLuHT+/HpgSpZ7EHDnfR9dUEjKoo3H6R8e+ewr9qbyews/yZyeng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XoFp0nePSas7xgzmyhzjFsHoKiflz+dMvPuW83tUaGs=; b=CClrub7NZk7XHeDsUDNhcS/v9R77DebKkXJY6dH82ASgO5DRJg+HsRYdjRj212WRtki1t+ejzz/hK+Wn9DxWVS7Nv9Ft09af/tyXhwhEWkl8Rbdo4OenPbqo83Kv3z467hWlNC6HmAWMarwMCkByYqxY9s8FIXT4+WPhJmfpCRQwDbNNZYI6y8laIzhMF81ku5h7QFgDOnGPgD4uf9vEweOXibc/vfkDINnwOFIiNHSdn7mIT948A0sW6Xat8Fs3wVqj6/Oteqww465X8vPI6/i/TXpYKFf+z/GCfNg28lWxSpzcX+4yhlb1wBlB952g06m2Hkp01eVMKIeLujHvZw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB7140.apcprd06.prod.outlook.com (2603:1096:101:228::14) by SEZPR06MB6119.apcprd06.prod.outlook.com (2603:1096:101:e8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.25; Sun, 29 Sep 2024 02:27:58 +0000 Received: from SEZPR06MB7140.apcprd06.prod.outlook.com ([fe80::9eaf:17a9:78b4:67c0]) by SEZPR06MB7140.apcprd06.prod.outlook.com ([fe80::9eaf:17a9:78b4:67c0%5]) with mapi id 15.20.8005.024; Sun, 29 Sep 2024 02:27:58 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Sat, 28 Sep 2024 20:43:43 -0600 Message-Id: <20240929024343.3763975-1-hanqi@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: TYCP286CA0117.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29c::15) To SEZPR06MB7140.apcprd06.prod.outlook.com (2603:1096:101:228::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB7140:EE_|SEZPR06MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: e0cc14f2-97aa-4a91-e79a-08dce02e5530 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: s43XswHeOtrTclNG5yBB3pTcWv/pV8ER8fT0nJl19qcT/KN6MoRkAeMVDcF6RP48lqZ4E5BNTkMv9B9Mm7gkYY8bcEmNy1+0uwksfBTEumX3jzjhvHFu0rT8ZnGHr3vS+k27R8QwkigRYyhg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4t0eoeIEL/DUTBbEN2VBEDgjkpIrFwCgPPRPPD42OI2Mj7CORLvuRuMO3iTcHtL9c4Ql52kxxpjAGEzieoxIVrXi+PH37SNlQLu2tmLku2AmnktgWZIkafHWlxVTGxzu27EqHGyooSDo6bWF0wQFnd6rY6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB7140.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a4svtNH9uHUQB2wCYY0ec0ibTRCEJIsACS/DOY4zmQbSwPamd00Wf0Wn/stp23OJNuRWS0p3diX6T6on72H72Wc9RcuINWiM9m6z3jzfVZbBnpLTgKohFwooNtJFOMuFyoF1icW02RR3E+wiiNLsRyXDn/gILDHTGpAFst3G0yAPhEnxeeSelWEEgemirPjjoaoaEGAd8BUzUUlp+v60SAExIuOZywJd6Wsljapj08w65jYvavQAhNcmWDFTFX3t+iEN2+pKXfnWfntcx01US7uUgq34TFZww5buOf3d/wTtjUtLyVaewozg9tCKmPswMuNrTorFTDmeA7NgNzM9wWhBjI7y+o+nbeBER4KBC275IDhHiBRmNUidBgyJf8E7n54NAGpUh/MwYbmtkCFOGeGyOD8AmEq08vCRbykGHSEVBbdGxPTd9fJUvuJVKmY18gK2S7eJUWgcpdgCR8jBQ29RnoDpOZe8xSOAAaBNZ2Ophz4s61q/FvnWgw//jQ6BsAePeMZelejfArwVhsbEkgJZAoqgwQbR0GUx6DBZ7lq1r7xqcipeaKWyjhYQKqfoPfpf9l2UeNwDCwoxYswEWKfPSQmFaUQNekv7xoxJnE/6CGTRINpRF3oxNEZsX92M2jxNra4B79I0fBpGJiFCbBsR/pG6wfy0irn+8R5JkFb7YqagVaOCp7advo6gQ0d4QFjqgK1rIBo6Io/ey4IKo2T8x3QdvtexY6VaMMDx2xFoOOW5d6b72J1mNT6f/YxvAUbQItKOOfY3teYyqfHQSEVImcKmsisg0+ckPUXkHv6H5Z5r7AEJSP+dVOx8HVKjeoVGtIosYeG8PK8gTvetxfoMXifqbJK7RVRXuEoXc8EV5wWlYSWB7pF6V0WeR4Dy0u8m5uRaGUvUjkqqIFaRdCXMOGvXilBTt842mt8cE7bbv+s1sE5dLo0lAXH2QU+IUyqdaedNqtkBfs1dw/6mEl1iJFiTV3lx/pKNmm3yWDMbViuhSGGh/tYawONeUfcsD9EpBN+DMUh9ANrYBwpAyCTKGZVVB6afLCjSCCEz/adSQI4tmbpLDt9MDCC5xzGpmMRXJnktS8uL2UIBdIgm/nUZRcmcmMROb4JGb9sAFKojClNx+vFPhqz5+03njiZNCrfc15Jvf2fhOZxeASfInLzTrY71nIHXrY4raZhRUTTwrhYnU9F2/7xVXYXlmh7Vh1DQJwGyFmtZ4lchdOH7xxpdMJdUNA5W677Dd1/yn/LihRpHXatJb85EIH9FovfR4IX3OiLFn0lG/KGakSufvBLr64zCm0kbZGI4LS7yxH12u8gYXabiLUSa5zyvanY+naXqdJDTzrZ9qcQfwLJL4oyqZy4POfDKM9bv0zrczRFZJpN14+B9gjfp+kwr04ITZMrkbeSiI7vlFrGAKuv4TRLVsC6bOQ4TvJxmZW2PHg/hxpmaF8Ov9J+M1H8v/VQ5DsOEN+0Cjj9iRZb5DkICPYI2B3JvDNky5M/fuiAG6F4f9eSppz367Py5QyNAyM2cL/f8jGNex7Ai0VsT4LIPJAiE/Ceg6Sa+X4/LdN5siaLixyXX71g6bmTjlni5I1M6 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0cc14f2-97aa-4a91-e79a-08dce02e5530 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB7140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2024 02:27:58.3793 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9sEy447GypYBzIGD3XoKWMUy9ZM4jCNc7ap+ZTRlxbaloOGK3aaqAZf02oHxMS2A0y0t2tiq0Dr5Cm3Q1PNmmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6119 X-Headers-End: 1sujfL-0002wh-74 Subject: [f2fs-dev] [PATCH] f2fs: compress: fix inconsistent update of i_blocks in release_compress_blocks and reserve_compress_blocks 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: Qi Han via Linux-f2fs-devel From: Qi Han Reply-To: Qi Han Cc: Qi Han , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net After release a file and subsequently reserve it, the FSCK flag is set when the file is deleted, as shown in the following backtrace: F2FS-fs (dm-48): Inconsistent i_blocks, ino:401231, iblocks:1448, sectors:1472 fs_rec_info_write_type+0x58/0x274 f2fs_rec_info_write+0x1c/0x2c set_sbi_flag+0x74/0x98 dec_valid_block_count+0x150/0x190 f2fs_truncate_data_blocks_range+0x2d4/0x3cc f2fs_do_truncate_blocks+0x2fc/0x5f0 f2fs_truncate_blocks+0x68/0x100 f2fs_truncate+0x80/0x128 f2fs_evict_inode+0x1a4/0x794 evict+0xd4/0x280 iput+0x238/0x284 do_unlinkat+0x1ac/0x298 __arm64_sys_unlinkat+0x48/0x68 invoke_syscall+0x58/0x11c For clusters of the following type, i_blocks are decremented by 1 and i_compr_blocks are incremented by 7 in release_compress_blocks, while updates to i_blocks and i_compr_blocks are skipped in reserve_compress_blocks. raw node: D D D D D D D D after compress: C D D D D D D D after reserve: C D D D D D D D Let's update i_blocks and i_compr_blocks properly in reserve_compress_blocks. Fixes: eb8fbaa53374 ("f2fs: compress: fix to check unreleased compressed cluster") Signed-off-by: Qi Han --- fs/f2fs/file.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9ae54c4c72fe..7500b4067996 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3791,12 +3791,6 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, to_reserved = cluster_size - compr_blocks - reserved; - /* for the case all blocks in cluster were reserved */ - if (to_reserved == 1) { - dn->ofs_in_node += cluster_size; - goto next; - } - ret = inc_valid_block_count(sbi, dn->inode, &to_reserved, false); if (unlikely(ret))