Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2616075pxb; Thu, 3 Feb 2022 10:12:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8ibnot3/JxdxCPQmPmYvcg/LioIxete5fo0lrpmUU/GngqPs99c5O7mC/SclVdHqruUMn X-Received: by 2002:a50:ef0c:: with SMTP id m12mr35330744eds.193.1643911956893; Thu, 03 Feb 2022 10:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643911956; cv=none; d=google.com; s=arc-20160816; b=jMPTj3cktNF8RazFrlY2y6DivtxP/HeiThUdGrzAdwSsPAu9FJ4Ezl5yHIF1piPJVg Dh2ugTGqVkaip/QkkPmYzu2wmaQk1Ss8dbO1pYQlT153EtzRaE/b/pXFxa9EU48BDsIo rH0VjuVSG7grSj9Ivbd+MalcZoY9QD4MXJGKUgVsaTcx5GVqh7XMqGEQzcPgCRNVAwIJ i1ItD1k1kFsXA4p2PdZHK+4EWUsPp4aYV1MbCTPCWH4CNEQijZWQ5IIbUkg4n0MypU0o wjMIuSPkO99KdDmvoFl3zIuMYhid+Atmprq/34TkliZuvmjiYwoMuHYgoRBZ+w8+Bd7Z R2nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BNRatYWjQm0fcsUYBvNGaWTgGWFUxP84PzInbvdppyc=; b=Ch8nkoyuyQKrfPQW1D4zS6y19akDtlC+CAV4nzuOwKnBpu7upJ8AbRD9qjJsrM28Qk tQbCWYkZi5eRp8TRQZy40h7MmsEDypn4AQH0gO1rhQTj2g+SyTxDmtEveyCl+nHrE1yP /345HtgCHTlSd0j5kWhrMAPzHhZ1SZJGYipmfCGb3iaqe6tiqeGva3HEt7OT96URXf4B QVdw1VOL2UoEn4Vqojm19q7GPHK/K/c5Nrdhk+NUyxLribvMxZQ2YhdCoxsF4Q1emPEO /7Xs1R9dl22JXufVS5cPspjnwV/oEAAIP8VAfFq0Wz6O7a8IJgw9Tsr6o8gGoklM7VYm SYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SK+mkJx8; 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 dn17si13535852ejc.646.2022.02.03.10.12.10; Thu, 03 Feb 2022 10:12:36 -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=SK+mkJx8; 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 S1351460AbiBCOr0 (ORCPT + 99 others); Thu, 3 Feb 2022 09:47:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351351AbiBCOrN (ORCPT ); Thu, 3 Feb 2022 09:47:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C674C06173D for ; Thu, 3 Feb 2022 06:47:13 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id AE503619C6 for ; Thu, 3 Feb 2022 14:47:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07328C340E4; Thu, 3 Feb 2022 14:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643899632; bh=HsISUCVfu1iUw1BVQ2l4vNJsgdtVwJ6qtpiQzSoC5as=; h=From:To:Cc:Subject:Date:From; b=SK+mkJx8u6S8ZgT7OW2Z+bbqatlwui/sMuRXvTn6ItzkjyGHBZZXJGwxQSfs79287 z+0aMg+lHj6gIMkdfG3T00Mvj24b1fUaiKxzlEi2/Ofb99QMM/W8djmhMJJDR/tfSZ xdaFCLaA/RQcdQA5F+vMSmDWl7eEGMcldz6zue4UBaw+QBserFBtEDyy93q/liRIZh yqie5ayExS+KmGqJs/EZpCCJG4++VpR9jWXofTJtbvPOEIVzIemit9xaG3mIdoN2op 0d1W67+YeDui5rOfznX876bXylj14gVZAZJJgg/MoSGLq5bvnjUmUOxyFPT2rk0tA7 bskTm/wQJoM6w== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , Pavel Machek Subject: [PATCH] f2fs: fix to unlock page correctly in error path of is_alive() Date: Thu, 3 Feb 2022 22:47:05 +0800 Message-Id: <20220203144705.23528-1-chao@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/ 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