From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F806C3ABCB for ; Tue, 13 May 2025 02:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:References:To:MIME-Version:Date: Message-ID:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=djnXi8M1IcWEJGrWi++O7yKDqOey7ds3Ej1SHmuisVc=; b=XKEhtgQnDtD1F0OUIzE5A31Hda VU17zSswTMOKD8cCFiGZ+Tm4PDafepLUVC2iSmGrLWbOqcVtZVdL5xUlvz3zJf26yj6sRUourXfcw Pknzl9USTTyAuWDzNH9lX0A6GUMC306grE0tvFraepiWP0xUZ/WGfSthbfuoXiWB2SOE=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uEfdk-0002MA-0a; Tue, 13 May 2025 02:45:08 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uEfdj-0002M4-GH for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 May 2025 02:45:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:To:Subject:Cc:MIME-Version:Date:Message-ID: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=G+Ccb6ZRDA6UIWyzC3PAPGDUY8jfow3qJQ/+yqhsC7g=; b=YgI+ftt1QXdDD+lFa4G+locwTz 3N/k225/4CezKf6oc5iyL+w0QF0zo6/qdBK4m1oorcR0SySEB4vfxdU1cg19k/cARYiALSccIAs+u lsMOeuL6nF5z5rrMqAC/EvP4vZ1Ag0dIt9cOITEXfNvkIEbGLeAxinkYd9iQW+xYVMEM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To: Subject:Cc:MIME-Version:Date:Message-ID: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=G+Ccb6ZRDA6UIWyzC3PAPGDUY8jfow3qJQ/+yqhsC7g=; b=ajXHHw57kV9CQTfEGnb7lTXY+S Fir85OaMOGAHdOxdniqpoPEdEPhY+t+nxpwEpV32IPjZR/C7Ij0+GnK13gFa+d1dHxqPA+85qwIvi pVVc6oTXhKUeCvwidmdAQZkLyzkv1DDjWV1FKgfWoRiW+gaVXaaVqPpgwJIvq6jno/Bw=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1uEfdj-0000hL-0O for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 May 2025 02:45:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 484E35C53DE; Tue, 13 May 2025 02:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593CCC4CEE7; Tue, 13 May 2025 02:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747104296; bh=ZFGIyXGw5+qmgsPzz6aL54r77OiRi4cTKJhtA4ObtoA=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=JyuD4GNN0s1sVLGX/wrJ9d85HO97sl7TDj+Bt3bjdv3qyUzSFPEOe362EyGYzh2Pw ixj1B+WjimwEmtFpfuiAFyb9XlRafRof9bq6jD1u44kQ8nlCuvipFxi6fR+hYh7pRH e2jfoPQwv7zs7uIpfE4NufVj6j5v7BhDYBkok7WgYH2WsS8hHkBKDONSGGpGSFdccQ xqTlgIgpDR42eW9RJQTqiFlETVQ6Opn/6sGGfQZvRfC418WI2aRpqKhyFoPZf1isKS djWuQSsTcDy83taRLCzXL8RlEMtuEK3glapxcsB/AxOhSjQgxHVfY6vV2ajLDGjm/k hMv97v8/hFqxg== Message-ID: <2a6bb772-901a-4054-80fa-7ff7cb118944@kernel.org> Date: Tue, 13 May 2025 10:44:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Jaegeuk Kim , g@google.com References: <20250512115442.2640895-1-chao@kernel.org> Content-Language: en-US In-Reply-To: X-Headers-End: 1uEfdj-0000hL-0O Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: add f2fs_bug_on() to detect potential bug 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: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 5/12/25 23:26, Jaegeuk Kim wrote: > On 05/12, Chao Yu wrote: >> Add f2fs_bug_on() to check whether memory preallocation will fail or >> not after radix_tree_preload(GFP_NOFS | __GFP_NOFAIL). > > Are we getting a bug? No, I'm worried about potential issue from add_free_nid() can cause node footer corruption issue, so I want to use f2fs_bug_on() to check whether there is caused by any bug from MM from now on. Thanks, > >> >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/checkpoint.c | 4 +++- >> fs/f2fs/node.c | 7 +++++-- >> 2 files changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c >> index e7907858eb70..3f223bade520 100644 >> --- a/fs/f2fs/checkpoint.c >> +++ b/fs/f2fs/checkpoint.c >> @@ -504,6 +504,7 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, >> { >> struct inode_management *im = &sbi->im[type]; >> struct ino_entry *e = NULL, *new = NULL; >> + int ret; >> >> if (type == FLUSH_INO) { >> rcu_read_lock(); >> @@ -516,7 +517,8 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, >> new = f2fs_kmem_cache_alloc(ino_entry_slab, >> GFP_NOFS, true, NULL); >> >> - radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + ret = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + f2fs_bug_on(sbi, ret); >> >> spin_lock(&im->ino_lock); >> e = radix_tree_lookup(&im->ino_root, ino); >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >> index 3f6b8037d25f..88d3032236cb 100644 >> --- a/fs/f2fs/node.c >> +++ b/fs/f2fs/node.c >> @@ -2309,7 +2309,7 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, >> struct f2fs_nm_info *nm_i = NM_I(sbi); >> struct free_nid *i, *e; >> struct nat_entry *ne; >> - int err = -EINVAL; >> + int err; >> bool ret = false; >> >> /* 0 nid should not be used */ >> @@ -2323,7 +2323,10 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, >> i->nid = nid; >> i->state = FREE_NID; >> >> - radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + err = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + f2fs_bug_on(sbi, err); >> + >> + err = -EINVAL; >> >> spin_lock(&nm_i->nid_list_lock); >> >> -- >> 2.49.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 C12633FBA7 for ; Tue, 13 May 2025 02:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747104296; cv=none; b=NfJ/Nuh/XCk0l7gjDGA3FnqmW2O1edqFy+KqRGQ9DJKQaB8oIG6i6unVSO7gTj1wRKozQpZhjapkARDL5eZybG2MB88bw4QaWxn6vqFldqh3jtYa+BJ/Xwga+Y3lrIq+okP5eOS8M/Lf7nnmUc5rrFjy9PHxEcZoQbcMFetwH4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747104296; c=relaxed/simple; bh=ZFGIyXGw5+qmgsPzz6aL54r77OiRi4cTKJhtA4ObtoA=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=BH4YOq+AbYduQ4mYGyz0uj2kIyZ4RgheyW81UnvMmPqFC1C6OsVU7vvgnEARh8K8xDZkH6lSEz1VQguAFth4qV3q0+v/Bnl8trEP+0Fg4Zdz5KjXqC2kkMULNKgU/9G7YwyB1o+3aM8h18+epTpWP2D5GSRDhEZnkSu6iWvoEjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JyuD4GNN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JyuD4GNN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593CCC4CEE7; Tue, 13 May 2025 02:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747104296; bh=ZFGIyXGw5+qmgsPzz6aL54r77OiRi4cTKJhtA4ObtoA=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=JyuD4GNN0s1sVLGX/wrJ9d85HO97sl7TDj+Bt3bjdv3qyUzSFPEOe362EyGYzh2Pw ixj1B+WjimwEmtFpfuiAFyb9XlRafRof9bq6jD1u44kQ8nlCuvipFxi6fR+hYh7pRH e2jfoPQwv7zs7uIpfE4NufVj6j5v7BhDYBkok7WgYH2WsS8hHkBKDONSGGpGSFdccQ xqTlgIgpDR42eW9RJQTqiFlETVQ6Opn/6sGGfQZvRfC418WI2aRpqKhyFoPZf1isKS djWuQSsTcDy83taRLCzXL8RlEMtuEK3glapxcsB/AxOhSjQgxHVfY6vV2ajLDGjm/k hMv97v8/hFqxg== Message-ID: <2a6bb772-901a-4054-80fa-7ff7cb118944@kernel.org> Date: Tue, 13 May 2025 10:44:53 +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 Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] f2fs: add f2fs_bug_on() to detect potential bug To: Jaegeuk Kim , g@google.com References: <20250512115442.2640895-1-chao@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/12/25 23:26, Jaegeuk Kim wrote: > On 05/12, Chao Yu wrote: >> Add f2fs_bug_on() to check whether memory preallocation will fail or >> not after radix_tree_preload(GFP_NOFS | __GFP_NOFAIL). > > Are we getting a bug? No, I'm worried about potential issue from add_free_nid() can cause node footer corruption issue, so I want to use f2fs_bug_on() to check whether there is caused by any bug from MM from now on. Thanks, > >> >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/checkpoint.c | 4 +++- >> fs/f2fs/node.c | 7 +++++-- >> 2 files changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c >> index e7907858eb70..3f223bade520 100644 >> --- a/fs/f2fs/checkpoint.c >> +++ b/fs/f2fs/checkpoint.c >> @@ -504,6 +504,7 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, >> { >> struct inode_management *im = &sbi->im[type]; >> struct ino_entry *e = NULL, *new = NULL; >> + int ret; >> >> if (type == FLUSH_INO) { >> rcu_read_lock(); >> @@ -516,7 +517,8 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, >> new = f2fs_kmem_cache_alloc(ino_entry_slab, >> GFP_NOFS, true, NULL); >> >> - radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + ret = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + f2fs_bug_on(sbi, ret); >> >> spin_lock(&im->ino_lock); >> e = radix_tree_lookup(&im->ino_root, ino); >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >> index 3f6b8037d25f..88d3032236cb 100644 >> --- a/fs/f2fs/node.c >> +++ b/fs/f2fs/node.c >> @@ -2309,7 +2309,7 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, >> struct f2fs_nm_info *nm_i = NM_I(sbi); >> struct free_nid *i, *e; >> struct nat_entry *ne; >> - int err = -EINVAL; >> + int err; >> bool ret = false; >> >> /* 0 nid should not be used */ >> @@ -2323,7 +2323,10 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, >> i->nid = nid; >> i->state = FREE_NID; >> >> - radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + err = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); >> + f2fs_bug_on(sbi, err); >> + >> + err = -EINVAL; >> >> spin_lock(&nm_i->nid_list_lock); >> >> -- >> 2.49.0