Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1386055rdd; Wed, 10 Jan 2024 19:05:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnN+hdzMj7pbiZe+KjetBO7uce6WCQ9y6M6is31FSofC3DaRYVcida6js0/AGDZw5V18/G X-Received: by 2002:a05:6e02:c73:b0:35f:df6e:b0c7 with SMTP id f19-20020a056e020c7300b0035fdf6eb0c7mr528487ilj.39.1704942338054; Wed, 10 Jan 2024 19:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704942338; cv=none; d=google.com; s=arc-20160816; b=eVUL/BDt4ZscF2srBgwSTCi+46zg0YiMYPqtEDKJLhG5b07KjAc8eB0WY2xfLUb/9B sB+nedSz4l8uwsWLcN3FKlxBDF/J5Q3EeunEUzmSTzBJZQ10+vhA5+Uq+O/N7jBFeZqW Dn1im7Ad5Jjv5YmhrIgxFwzaP2NcOrdFee7ANzIJP4gmnUiSjf+0gkKvsvAiN7G2+1yX +M/tFq+68OWGM8vR0RbmNhtUDNp19k5tnGdsm3PtUIkqu/EAGOT6VK+p4XEG/b/dhTZ4 /1bLvim+ma0z8mQFJGz/EWl5Fd8Ow0n4C9lXdEN6EhaM9idl4QMUtP79BHosWxLYQ8sG 5feA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=p8zGpnOhjIsJWTG2MP0QX1nzu+G45rqkX5txUzJsb6U=; fh=1D7eQ/0rc+iU6BAcs/KVKWP4G7WgjJ9VzUdfNwtKJ+I=; b=ZZ4UyjZHYqMA36Dyuzln5tCwsAfyyR8fJsuRhCYYbB3GfnwtJgbXa3anzwNTGUkN9B 4rfE5Gp4yB7glBWYeS1g22lo9CoUwxvOijjT11IKf00xXtlp9W2+BoGOYjJS35Yzy9lZ 8WSRhOzrCQ/OZkwJEdEWO4Sc3Pj7ujBMreKnOrebG3IHOM7V+imtoQ5BIJoEsbYUX7Ep DTq3DxCfnBnKY8AaJG+1uQMN+0uk+zyFvWFYojUao5oXZbavFh1IIaiMcjI7CmAQ+byQ 2RqZpX0Km1TBEIhAUZTD+q+UNeIbqTAeT5ncmZouqyM0iA0eDyoO9gPudw5EeNOIN1qp 5qsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nfHJFtxd; spf=pass (google.com: domain of linux-kernel+bounces-23008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r144-20020a632b96000000b005cdfe3e662asi122505pgr.825.2024.01.10.19.05.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 19:05:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nfHJFtxd; spf=pass (google.com: domain of linux-kernel+bounces-23008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AE0D528AE4F for ; Thu, 11 Jan 2024 03:05:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0373817C1; Thu, 11 Jan 2024 03:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nfHJFtxd" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2335F15A1 for ; Thu, 11 Jan 2024 03:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EE71C433C7; Thu, 11 Jan 2024 03:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704942328; bh=ZLl7kGhUGnW8PU9f96aUKCXnoo6LveMARPa7a8KWG2Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=nfHJFtxdOgtxfL8bGvcbya4xrqDfq0X4ap6ZPPhlccn+oCJlmfee52k5DxySQrQ7I gnofBMPaGIDJHzG1qy/pgIKOPetWaJ9ZEXEuxpXgnh03m/XP0j5x1OIYjqOZb+ey0I yRGUOnzuPqvKvsCZ67Dmed4EWbcTjwy7IrLprXyiYOrLPHYrtQrmMkdRQrmjm2ys5c +RDg+ZzYaQgPQmp3IMZlMQQRQDj0U+SN199y+yfQ55xoTXs7xB/rn+tOjQcAZy/Uxh T6Ev7JBQZ7HjmffMQ5PsKeYwIv7ph2z61h16w+qR3+dYK+R+LQvKcrepo0m+5PvosT Oej4YjptoMV6Q== Message-ID: <70a44ec7-8842-47d3-86d4-67dd173f9d82@kernel.org> Date: Thu, 11 Jan 2024 11:05:19 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 6/6] f2fs: introduce FAULT_BLKADDR_INCONSISTENCE To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20231228143152.1543509-1-chao@kernel.org> <20231228143152.1543509-6-chao@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/1/3 4:55, Jaegeuk Kim wrote: > On 12/28, Chao Yu wrote: >> We will encounter below inconsistent status when FAULT_BLKADDR type >> fault injection is on. >> >> Info: checkpoint state = d6 : nat_bits crc fsck compacted_summary orphan_inodes sudden-power-off >> [ASSERT] (fsck_chk_inode_blk:1254) --> ino: 0x1c100 has i_blocks: 000000c0, but has 191 blocks >> [FIX] (fsck_chk_inode_blk:1260) --> [0x1c100] i_blocks=0x000000c0 -> 0xbf >> [FIX] (fsck_chk_inode_blk:1269) --> [0x1c100] i_compr_blocks=0x00000026 -> 0x27 >> [ASSERT] (fsck_chk_inode_blk:1254) --> ino: 0x1cadb has i_blocks: 0000002f, but has 46 blocks >> [FIX] (fsck_chk_inode_blk:1260) --> [0x1cadb] i_blocks=0x0000002f -> 0x2e >> [FIX] (fsck_chk_inode_blk:1269) --> [0x1cadb] i_compr_blocks=0x00000011 -> 0x12 >> [ASSERT] (fsck_chk_inode_blk:1254) --> ino: 0x1c62c has i_blocks: 00000002, but has 1 blocks >> [FIX] (fsck_chk_inode_blk:1260) --> [0x1c62c] i_blocks=0x00000002 -> 0x1 >> >> After we inject fault into f2fs_is_valid_blkaddr() during truncation, >> a) it missed to increase @nr_free or @valid_blocks >> b) it can cause in blkaddr leak in truncated dnode >> Which may cause inconsistent status. >> >> This patch separates FAULT_BLKADDR_INCONSISTENCE from FAULT_BLKADDR, >> so that we can: >> a) use FAULT_BLKADDR_INCONSISTENCE in f2fs_truncate_data_blocks_range() >> to simulate inconsistent issue independently, >> b) FAULT_BLKADDR fault will not cause any inconsistent status, we can >> just use it to check error path handling in kernel side. > > How about defining FAULT_BLKADDR_VALIDITY and FAULT_BLKADDR_CONSISTENCY? Better, :) Thanks,