Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1297641lqh; Mon, 6 May 2024 03:33:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWs05k9apZTNM4O+quMdF2Cyv+dhzItHNKpZnjOkK4KGEjnvCNXlbRWu+BU+12APsfVuhqNa9GfJ6Nmhb0YGvgH2Ulj/0Q1CuwrCFImfA== X-Google-Smtp-Source: AGHT+IF12de26HsIqEC901sRlOgkkWPiMDQjSMnUmIJp20VGErzsj9pG+F9SW95xYYQVnu6JqGhN X-Received: by 2002:a17:90a:3f16:b0:2ad:4321:5bd3 with SMTP id l22-20020a17090a3f1600b002ad43215bd3mr8178793pjc.15.1714991605506; Mon, 06 May 2024 03:33:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714991605; cv=pass; d=google.com; s=arc-20160816; b=I/7QznLQ7ZL2/zZN4bLd9ROZ3jNGFJ9JQB9g2FX+DmocKi5AhIs6ROXE7Tk8tmcVl+ +/94NYYdysmYN/EYji5ImEkqupGWlaVtPuXlZNxc5IaXHjJtnA1IOvvOBQlPJy3h8qY4 jv4l7oz51eQpHm4K6w0PwtP1gXe0RgENwBOAYCU2w2UfLim2j0pW9iR/493FduJ+PVo/ 6uiApKsvg/MJP6eslX1ROtofqEjmMvC6EpoYAybOjvFcPfT4kT/igSB+XpXDC22gCehI cnRP5al+fbSuzOigSuvW6VYIJCoaTNMOaslyiKuexyGAZgGQbUBQzTvijtaaqLhj6xe4 mBwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=E31uoUDJOzIfmIKHvU27ZHbfL5V9s59Wb7nHBi2/TxA=; fh=X1/oBJvTGJUQ0YtRp03u+3tPfRw/dXXALWynfOSlfQQ=; b=aAoqY9KyHjKh2QR1q8BQFPy9dFgxK5B8ieCFwy66/1+42xro0SG8fvJj/f9tvTdZlt 2ky/4QpjujRi+NBah/ErBz5mdRTMh96XhjZn07VEviJYBOfKjHihY8BUH3RQOc9rwXcN 94Sz6TLNjkWEuRRtuc6dunGnsQCx2D2/fOcqPZQW+uQamaOJSmHe+JvbLxr6PbCFMtBv J/stOKLdKnHY+FyMje/lNOUIJotMDiV7z+gvYdqt/SOw8u9qNQTHNSdEhdY+ZoHJ375C sKaEtC2XHvotrt/3aQwtfbtkTwhPp623ANUW/gocCqwfKugc3iU7OmDTB5FQ2EO2IV6L Dvuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PO3HNL/N"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169672-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169672-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. [139.178.88.99]) by mx.google.com with ESMTPS id u19-20020a17090ae01300b002b43505df05si6715434pjy.144.2024.05.06.03.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 03:33:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169672-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PO3HNL/N"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169672-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169672-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 DF4C9283108 for ; Mon, 6 May 2024 10:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD5DD40855; Mon, 6 May 2024 10:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PO3HNL/N" 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 D8C8023D2 for ; Mon, 6 May 2024 10:33:19 +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=1714991599; cv=none; b=c4aQL+uhpoY929DmPflqbmEYK0jLHRQPQuG8ads0LCyk8tDExubwMvNRLUVvsbV21ScL3hs9/XlsBKSUbbJxwPNeDcP1xhX10wFlbKIVqzYbLGlTvktViW8sthXyYuEk3bPJfDTbFqLanZ8mfvlAoNWVfUQhV2qm14GYnTHGNkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714991599; c=relaxed/simple; bh=ArQZcPL9NskSWJ33AcpZ7fqpChWS94RCsV5KimDJTWY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=iEay2yK6psPOqYk4Rb8/1pfWj7TsjQlLt5Y6ANw31PuOYyiYfsnfVIwUYJlV8/iGtfi9500uhhroCISSr8vieDWFpia+Vc2kGIzImcOw6YhEvvgvYI/SzjVNkPVlUfpS57/WLFMsJzPmCbjSNdaV/rmDq4mkFkX8xwH8LuV5ODg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PO3HNL/N; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CA1BC116B1; Mon, 6 May 2024 10:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714991599; bh=ArQZcPL9NskSWJ33AcpZ7fqpChWS94RCsV5KimDJTWY=; h=From:To:Cc:Subject:Date:From; b=PO3HNL/NaetYrGgi4hGaAP0vK2LQfQyHtc5/VlCpgZx3gPrczk+9ZmblggC9/m3z3 85Z76E4GjDW7N/t/6kY7dkRuAJ3BujwzquOE3LVHB3ZTgCNhqtIDxPjVfIlabMw2s9 P1TC86GbAmremkhH1O2Vr3ed1AgbwQ+d7Y4Lm0OTFfgosuABRvprrwIN1MIU4SpKjl Htn29yMbng/+bMit+Ic0OEZ/gV43EjgcfojFEiiaBkHUBSaT7qt2qsjd/zZcw/hWiP GK8HfY+W8UNX9nazhsaKQ6INN3BtApxRKariBmzFuNCOpcvznZ4qLkEvQqW+a+W7GP mIEhU2Oxr68dA== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page() Date: Mon, 6 May 2024 18:33:11 +0800 Message-Id: <20240506103313.773503-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It missed to call dec_valid_node_count() to release node block count in error path, fix it. Fixes: 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()") Signed-off-by: Chao Yu --- fs/f2fs/node.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index b3de6d6cdb02..ae39971825bc 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1313,15 +1313,14 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) #ifdef CONFIG_F2FS_CHECK_FS err = f2fs_get_node_info(sbi, dn->nid, &new_ni, false); - if (err) { - dec_valid_node_count(sbi, dn->inode, !ofs); - goto fail; - } + if (err) + goto out_dec; + if (unlikely(new_ni.blk_addr != NULL_ADDR)) { err = -EFSCORRUPTED; set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR); - goto fail; + goto out_dec; } #endif new_ni.nid = dn->nid; @@ -1345,7 +1344,8 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) if (ofs == 0) inc_valid_inode_count(sbi); return page; - +out_dec: + dec_valid_node_count(sbi, dn->inode, !ofs); fail: clear_node_page_dirty(page); f2fs_put_page(page, 1); -- 2.40.1