Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp257514pxb; Mon, 7 Feb 2022 10:33:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDnQJIVdgEVTUzQUiAXCF+8kHB5HFAK7MRN0mbG/UnfK1mMAVAi2RMtjE+9+aLyJcftt0r X-Received: by 2002:aa7:cb87:: with SMTP id r7mr805775edt.284.1644258789509; Mon, 07 Feb 2022 10:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644258789; cv=none; d=google.com; s=arc-20160816; b=el3jX+AdTtcuode60mRr3wF78JOdSrqw5Z5ZRDAjDiYmFHTGlYtq7dHEtpxalNfrrG lfnY0TFgu669g6gSHf22eIo0WyT3Ee8H2AV2aDV+ez8jfMarfXCeT7nRBqOVq4jtdvHw SVjbWAZd8nSON1dXJavYWn2V5kh9m2THvOJaETYwaML6wpJzoOCwx0kj3GnfYU8bC66P jD9faeNoK6EXYvSaVvLLDyza3OYo1iuiXWXgR98lglNxgUQ5lQKM/HfM16livS6BdwQL PsyaLojvirdZC925h1xeiD2GJvx6jrdyGqh7FjZFqlrhmmyqwpQWkitu/6VY7kbsNBG+ EgRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=HVcbGmBTmP6fEQxw9BPmPJPQoW+Ws9gPf+S7lPtPqpA=; b=B43Q4Lw+jK5PWG455pVMU3UsqMYqFjACaYQwkqEyRKTcKC0ajuVK+O7dxMCEHnjq/f haaoo9ORsM29xp93/OnH+ZQaVxr6/XexiRPCI9GciEv5aSnzE6FNcsjviI/DSwxI2ni7 02yVkmp20nV/zO37I54/5Rgf6lOJz4JFQgUV0GowWyg4v3w19LfYDIZBn08S7Tp1nySe qCTxFDd1OniP2e9tHT7vE3AUWDH98Z3g1ITxrUof2JonOFxTml8bjhIOGr1/d0528VzT Tt/v4ee5moLsiuG3OB4bDNL2oJsHGOiHUWuIJ6cYq3vGV1FJDp7YWit1Vp2B701t/7pY ilNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqOpNuHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr16si7194503ejc.579.2022.02.07.10.32.44; Mon, 07 Feb 2022 10:33:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqOpNuHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356578AbiBDDTz (ORCPT + 99 others); Thu, 3 Feb 2022 22:19:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40468 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbiBDDTy (ORCPT ); Thu, 3 Feb 2022 22:19:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20C07B83654 for ; Fri, 4 Feb 2022 03:19:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 995B8C340E8; Fri, 4 Feb 2022 03:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643944791; bh=ZlIGcuypCyxj9pYmnJrdabP+w4iW8DzvlECu6ZAvYc8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jqOpNuHa9UFJfOYzzBlS61vK2kMADyjb2qAnQDZe1p/KPv107AkasJinDP95LZRqJ 3QFZ4j4mt0Qvwz4myjzGUzda423myiIxvh/Yjs4BqqmTKlXVQ+8/8Z8R+XasKbz+OO RgvqvtaV6Sc+ONZXke77i4xFw3aQDBybj0waXbtZnVLkVihPoCHyFNPxPxRqQk+2t1 EVPKG2efvy3ic16o/hHQoJ5ZkyuH3o/Inj4aMBHBqcT59fR+iAlmKX896iygRpIuCl VCagGdRAgnQ92V1Tz/kwAqYJJuYJmtkgLAytkST5Zp/RGHL6N0WfEqYfsqZ+jneAc4 wOxmExkLfeQcQ== Message-ID: <9faddf59-0c09-aa20-981a-65b06c4517ae@kernel.org> Date: Fri, 4 Feb 2022 11:19:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] f2fs: fix to unlock page correctly in error path of is_alive() Content-Language: en-US To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Pavel Machek References: <20220203144705.23528-1-chao@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/2/4 4:03, Jaegeuk Kim wrote: > On 02/03, Chao Yu wrote: >> As Pavel Machek reported in below link [1]: >> >> After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"), >> node page should be unlock via calling f2fs_put_page() in the error path >> of is_alive(), otherwise, f2fs may hang when it tries to lock the node >> page, fix it. >> >> [1] https://lore.kernel.org/stable/20220124203637.GA19321@duo.ucw.cz/ > > Need -stable? It seems 4.19+? It depends on where commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()") be backported to? Anyway, let me Cc stable-kernel mailing list. Thanks, > >> >> Fixes: 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()") >> Reported-by: Pavel Machek >> Signed-off-by: Pavel Machek >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/gc.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 0a6b0a8ae97e..2d53ef121e76 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -1038,8 +1038,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, >> set_sbi_flag(sbi, SBI_NEED_FSCK); >> } >> >> - if (f2fs_check_nid_range(sbi, dni->ino)) >> + if (f2fs_check_nid_range(sbi, dni->ino)) { >> + f2fs_put_page(node_page, 1); >> return false; >> + } >> >> *nofs = ofs_of_node(node_page); >> source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); >> -- >> 2.32.0